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));
        this.setBackground(Color.white);
        this.setBounds(0,0,ID.toggleX*3,ID.toggleY*3);

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?
       
muliLessaAsked:
Who is Participating?
 
objectsCommented:
are they both running on the same os?  could be different l&f
set the l&f explicitly if thats the case
0
 
colr__Commented:
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:

getContentPane().setBackground(Color.white);
0
 
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.
0
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.

 
colr__Commented:
Sorry, try setting the background directly on the JPanel instead
0
 
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.
0
 
colr__Commented:
I suspect it is more likely to be the component which the JPanel has been added to, the content pane of the window itself
0
 
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.
0
 
muliLessaAuthor Commented:
Thx objects! That's it!
0
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.