Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem displaying components in swing application

Status
Not open for further replies.

Phella

Programmer
May 4, 2003
2
GB
I am creating a Minesweeper game.

There is a grid of X * Y "Square"s which extend the JButton class.

Everything was working fine, all the buttons were displaying and all the functionality of the game were there and working.

Then I changed the Square class, adding two integer variables x and y so that it knew where it was in the grid. I also changed a method in the class which revealed blank squares.

And now, when I start up the application only one Square appears in the top left of the grid! All the squares are there but they don't reveal themselves until they are clicked on.

It's crazy! I've had a similar problem before when making a chess game, only then the squares did appear when you hovered the mouse over.

It's such an annoying problem and I hope someone out there can tell me how to solve it 'coz I'm going out of my mind trying to work something out!! :)
 
Okay, I've worked it out.

I'd created two methods in the Square class: int getX() and int getY().

Presumably they overrided some other methods in a bad way.

Hope this is useful information for someone else with the same problems.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top