Search:

Type: Posts; User: copeg

Search: Search took 0.17 seconds.

  1. Replies
    5
    Views
    3,259

    Re: Trying to add a close button

    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(...
  2. Replies
    5
    Views
    3,259

    Re: Trying to add a close button

    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.
  3. Replies
    5
    Views
    3,259

    Re: Trying to add a close button

    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...
Results 1 to 3 of 3