How ca i set Background Color in my JInternalFrames?

1.4k views Asked by At

I need to set the background color in my JInternalFrames. I couldn't.

JInternalFrame frm = new JInternalFrame(); frm.setBackground(Color.red);

This don't work.

You knows how can i do this?

Thanks You.

2

There are 2 answers

0
camickr On BEST ANSWER

Swing windows (JFrame, JDialog ...) and internal frames use a "content pane" to hold child components. So you need to set the background of the content pane:

internalFrame.getContentPane().setBackground( Color.RED );

Read the section from the Swing tutorial on Top Level Container for more information.

Keep a link to the Swing tutorial handy for all the Swing basics.

0
Roberto Attias On

try calling setOpaque(true) on the JInternalFrame