Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Java by tttt ( 8 years ago )
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextField;

public class example{
 JFrame fr;
 JTextField tf;
 JButton bt;

 void manupilate() {
  String m = tf.getText();
  m = "Hello " + m;
  tf.setText(m);
 }

 public example() {
  fr = new JFrame("");
  fr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  fr.setSize(250, 200);
  fr.setLayout(null);

  bt = new JButton("Ok.");
  bt.setSize(100, 40);
  bt.setLocation(20, 80);
  bt.addActionListener(new ActionListener() {

   @Override
   public void actionPerformed(ActionEvent e) {
    manupilate();
   }
  });

  tf = new JTextField();
  tf.setSize(200, 40);
  tf.setLocation(20, 20);
  fr.add(bt);
  fr.add(tf);
  fr.setVisible(true);
 }

 public static void main(String[] args) {
  example e = new example();
 }
}

 

Revise this Paste

Your Name: Code Language: