How do I customize the title bar for a window, frame, or dialog?
Created May 20, 2005
John Zukowski Starting with the 1.4 release, you can provide your own window adornments or decorations.
import java.awt.*;
import javax.swing.*;
public class AdornSample {
public static void main(final String args[]) {
Runnable runner = new Runnable() {
public void run() {
// specify that newly created JFrames should be
// decorated by the L and F
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame frame = new JFrame("Adornment Example");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(300, 100);
frame.setVisible(true);
}
};
EventQueue.invokeLater(runner);
}
}
You can also use setWindowDecorationStyle() to change the style for different types of windows. To customize what actually is used requires you to modify the look and feel.