NullpointerException error.

  • (3 Pages)
  • +
  • 1
  • 2
  • 3

30 Replies - 1509 Views - Last Post: 16 January 2013 - 12:29 PM Rate Topic: -----

#31 GregBrannon  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2197
  • View blog
  • Posts: 5,224
  • Joined: 10-September 10

Re: NullpointerException error.

Posted 16 January 2013 - 12:29 PM

I think (says a small voice from the wilderness) the only size that matters is the size of your graphic, and the only reason you care about that is to divide it into approximately nine equal subimages.

There is another approach:

Create a GameFrame Insets instance variable:
Insets buttonMargin;

Initialize it in the constructor before calling the initialize() method:
buttonMargin = new Insets( 0, 0, 0, 0 );

Set each button's margin after you create the button
button[a].setMargin( buttonMargin );

Doing the above after removing any remaining setSize() or setMinimumSize() or setPreferredSize (et al) statements should get you another step closer to the look you're after.
Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3