GridLayout, BackgroundColor

I have a JPanel with a GridLayout, which contains 3rows and 3 cols of JToggleButtons:
        setLayout(new java.awt.GridLayout(iMax,jMax,0,0));

The backgroundcolor of the JoggleButtons is currently white.

When compiled in Eclipse, there are grey lines in between the JoggleButtons, when compiled
in NetBeans there are no such lines.

How can I assure that those lines are not displayed?
Who is Participating?
are they both running on the same os?  could be different l&f
set the l&f explicitly if thats the case
The location where you compiled it shouldnt matter, do you mean its showing as different in the gui designers? You need to set the background on the content pane to be white as well:

muliLessaAuthor Commented:
Thx, colr!
...its showing as different in the gui designers: Yes, therefore I think that "something is missing"
in my code, which is "added" in NetBeans, but not in Eclipse.

I tried Your solution, but getContentPane() does not work for a JPanel.
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Sorry, try setting the background directly on the JPanel instead
muliLessaAuthor Commented:
I am doing that (see above: this.setBackground(Color.white);
this is a class which extends JPanel).

I guess that perhaps the background of the gridlayout should be set - but
I don't know how to achieve that.
I suspect it is more likely to be the component which the JPanel has been added to, the content pane of the window itself
muliLessaAuthor Commented:
The component which contains the JPanel is a LayeredPane, which has (needs to have) the BG-color brown - so it can't be responsible for the grey lines between the gridcomponents.
muliLessaAuthor Commented:
Thx objects! That's it!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.