No, because you need a reference to the button to add a listener to it...in pseudocode:
JButton quit = new JButton("text");
whatever.add(quit);
quit.addActionListener(...
Type: Posts; User: copeg
No, because you need a reference to the button to add a listener to it...in pseudocode:
JButton quit = new JButton("text");
whatever.add(quit);
quit.addActionListener(...
public void run(JButton"quitButton");
This is not a correct format...you want to create your button object as you would any other object within the run method.
Members of a class have access modifiers, but variables declared within a function (in this case main) aren't defined with access modifiers. If you want the JButton within main only, remove the...