Search:

Type: Posts; User: KevinWorkman

Search: Search took 0.11 seconds.

  1. Replies
    11
    Views
    2,060

    Re: ActionListener question.

    Well, assuming some things (I don't know much about C#), that's not too different than how Java can work. You can set public class variables like that, but JLabel's text variable is not public. This...
  2. Replies
    11
    Views
    2,060

    Re: ActionListener question.

    Like I said, what happened when you tried?

    But I can tell you right now that that won't work. First of all, that's not how you set the text of a JLabel. Secondly, the addActionListener() method is...
  3. Replies
    11
    Views
    2,060

    Re: ActionListener question.

    What happened when you tried?

    But it really depends on what you mean by "return it to the JLabel". Can you set the text of a JLabel to a value returned from some method? Sure, as long as you have...
  4. Replies
    11
    Views
    2,060

    Re: ActionListener question.

    The actionPerformed() method is void, so it can't return an int or anything else, whether it's in an anonymous class or its own public class in its own file. Instead, you're going to have to make...
  5. Replies
    11
    Views
    2,060

    Re: ActionListener question.

    The advantage is that is saves time and space. Usually things like ActionListeners don't do all that much, so making them their own named class doesn't make a ton of sense. Do whichever fits into...
Results 1 to 5 of 5