Hi does anyone know how to get the color of the title bar in an
internal frame?
When I create my own dialog and then get the color from the UIManager
my dialog
title bar is light blue instead of dark blue like my main JFrame?
any help on this would be much appreaciated!!!
Below is my code...
I have created a my own dialog and set it as undecorated adding a my
own title
bar. I set the color of this bar using the
UIManager.getColor("InternalFrame.activeTitleBackground");
where "InternalFrame.activeTitleBackground" is defined in
javax.swing.plaf.basic.BasicLookAndFeel
I have also tried several other properties in BasicLookAndFeel:
activeCaption, inactiveCaption, inactiveCaptionBorder,
activeCaptionBorder,
menu
but none of them are correct!!
public class MyDialog extends JDialog
{
public MyDialog ( Frame owner,String dialogTitle, String
initialText )
{
super(owner);
//Removes the default title bar of the dialog, We do not want
a close
//button.
setUndecorated( true );
//We still what the dialog to have a title bar so create this.
JPanel header = new JPanel();
JLabel title = new JLabel();
title.setText(dialogTitle);
title.setOpaque( false );
header.setLayout( new BorderLayout() );
//get the color of title borders.
//This is defined in javax.swing.plaf.basic.BasicLookAndFeel
Color titleBorderColor =
UIManager.getColor("InternalFrame.activeTitleBackground");
header.setBackground( titleBorderColor );
header.add( title , BorderLayout.CENTER );
JPanel contents = new JPanel();
contents.setBorder( BorderFactory.createRaisedBevelBorder());
contents.setLayout(new BorderLayout());
contents.add(header, BorderLayout.NORTH);
setContentPane( contents );
//add the progress bar and stop button to this dialog.
pack();
}
}
Sandip Chitale - 19 Nov 2003 16:41 GMT
<http://java.sun.com/j2se/1.4.2/docs/api/java/awt/SystemColor.html#activeCaption>
> Hi does anyone know how to get the color of the title bar in an
> internal frame?
[quoted text clipped - 56 lines]
> }
> }