swing Java tutorial - doesn't work, how to resolve?
GregBeutler

https://repl.it/@GregBeutler/brokentutorialJavaSWing

I copied the jswing Java tutorial and it doesn't work!

pls advise.
Greg

You are viewing a single comment. View All
ParthaSarathi6

import java.awt.;
import java.awt.event.
;
class Main extends Frame implements ActionListener {
TextField t;
Main() {
super("Event Handling - ActionEvent");
t = new TextField();
t.setSize(30,30);
t.setBackground(Color.green);
t.setForeground(Color.red);
Button b = new Button("click Me");
b.addActionListener(this);
setSize(300,250);
setLayout(new GridLayout(2,1));
add(t); add(b);
setVisible(true);
}
public void actionPerformed (ActionEvent ae) {
t.setText("Keep Learning");

{
new Main();
}
}