How do I customize the title bar for a window, frame, or dialog?

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.
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact