Search:

Type: Posts; User: KevinWorkman

Search: Search took 0.20 seconds.

  1. Replies
    20
    Views
    2,637

    [SOLVED] Re: NullPointerException with JSlider

    You could probably do it either way. Which way did you try?
  2. Replies
    20
    Views
    2,637

    [SOLVED] Re: NullPointerException with JSlider

    Well, a good place to start with custom painting is here: Lesson: Performing Custom Painting (The Java™ Tutorials > Creating a GUI With JFC/Swing)
  3. Replies
    20
    Views
    2,637

    [SOLVED] Re: NullPointerException with JSlider

    Glad you got it figured out. And just to show you the process, I figured that out by putting a print statement inside the constructor. When I saw that printed out twice, I knew something was wrong.
  4. Replies
    20
    Views
    2,637

    [SOLVED] Re: NullPointerException with JSlider

    I am behind a firewall that prevents me from viewing that type of link. Besides, you should make it as easy as possible for other people to help you. The best way to do that is by creating an SSCCE....
  5. Replies
    20
    Views
    2,637

    [SOLVED] Re: NullPointerException with JSlider

    You haven't posted your code for MyShape, so I can't run your program.

    I suggest boiling your problem down to an SSCCE and posting that.

    Without seeing an SSCCE, the best I can do is repeat...
  6. Replies
    20
    Views
    2,637

    [SOLVED] Re: NullPointerException with JSlider

    Java doesn't magically know how to print an object. To tell it how to do that, you have to override the toString() method.

    You're printing out the value of myShape. But the variable that's null is...
  7. Replies
    20
    Views
    2,637

    [SOLVED] Re: NullPointerException with JSlider

    Are you sure the setShape() method is called before the stateChanged() method? What happens if you don't click a menu first?
  8. Replies
    20
    Views
    2,637

    [SOLVED] Re: NullPointerException with JSlider

    Well, when is that setShape() method actually called? Again, use a debugger or add print statements like I showed you to figure out. You'll find that this line:

    System.out.println("here");

    will...
  9. Replies
    20
    Views
    2,637

    [SOLVED] Re: NullPointerException with JSlider

    Your error means that a variable you're dereferencing (using the dot operator) is null. You can't dereference a null variable.

    The only variable you're dereferencing in this line is your theShape...
  10. Replies
    20
    Views
    2,637

    [SOLVED] Re: NullPointerException with JSlider

    What variable is null on line 79 of MyControlPanel.java?

    You can use a debugger, or some print statements, to figure it out.
Results 1 to 10 of 10