Search:

Type: Posts; User: KevinWorkman

Search: Search took 0.12 seconds.

  1. Re: Help with checking to see which menuItem has been selected

    I agree that your example works great and accomplishes the goal. The problem the OP has is with the process of updating values of variables between classes, and using inner classes that all refer to...
  2. Re: Help with checking to see which menuItem has been selected

    The above example sorta "cheats" by throwing it all in a single class and using inner classes. I think the OP is going for a solution using multiple classes. I'm not going to spoonfeed him the...
  3. Re: Help with checking to see which menuItem has been selected

    You don't pass a Shape value into the MyControlPanel constructor, do you? And you call a setShape() function on the MyControlPanel class, right? So why not do something similar with your DrawShape...
  4. Re: Help with checking to see which menuItem has been selected

    You already set the shape value in MyControlPanel, why can't you do something similar with the DrawShape class?
  5. Re: Help with checking to see which menuItem has been selected

    You need to set the value of theShape in DrawShape whenever the user changes it. Java doesn't automagically update variables for you. For example:

    String s = "one";
    String t = s;
    s = "two";...
  6. Re: Help with checking to see which menuItem has been selected

    I see that you're setting the value of theShape in your MyControlPanel class, but that's a completely different variable than theShape in your DrawShape class.
  7. Re: Help with checking to see which menuItem has been selected

    Your DrawShape instance is inside your MyControlPanel constructor. How are any of the listeners accessing that instance to pass in the selected shape or size?

    Again, I highly suggest taking this...
  8. Re: Help with checking to see which menuItem has been selected

    When do you add the DrawShape to the JFrame? When do you call the setShape() method?

    I recommend hardcoding a shape and putting it in a basic JFrame by itself and seeing if that works. Test your...
  9. Re: Help with checking to see which menuItem has been selected

    What does your posted code do? What do you expect it to do? This would all be so much easier to help you with if you started with an SSCCE instead of chunks of your whole program.

    One thing that...
Results 1 to 9 of 9