A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing


  • one year ago

I'm getting a nullpointer exception at line 33.

  • This Question is Closed
  1. rsmith6559
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    getContentPane().setLayout(null); This looks wrong. A setLayout() function ususally wants a type of layout as an argument, and I wouldn't be surprised if passing it null is causing the exception.

  2. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    You initialize speed: ``` JSlider speed; //Speed of ball ``` So at this point it is null. Later on you call: ``` speed.setBounds(1, 1, 50, 50); ``` You are calling a method for a null value, which isn't possible. You need speed to be initialized. For example you would need something along the lines of `speed = new JSlider()` to ensure that it's a non-null object. Then you can call methods on it.

  3. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...


  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.