khangaikhuu / advanced-cs

2 stars 0 forks source link

Creating a Button Team KEA #40

Open erhem1 opened 5 years ago

erhem1 commented 5 years ago

In java swing example import java.awt.event.;
import javax.swing.
;
public class ButtonExample {
public static void main(String[] args) {
JFrame f=new JFrame("Button Example");
final JTextField tf=new JTextField();
tf.setBounds(50,50, 150,20);
JButton b=new JButton("Click Here");
b.setBounds(50,100,95,30);
b.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
tf.setText("Welcome to Javatpoint.");
}
});
f.add(b);f.add(tf);
f.setSize(400,400);
f.setLayout(null);
f.setVisible(true);
}

syntigs commented 5 years ago

mr erhmee