Hi,

How do you disable the minimize button in a JFrame. I only want to disable the minimize button, not the close and maximize button. Please help me with this one. Thanks.

Recommended Answers

There is no way u can do this.... You can create ur own title bar by overiding the original title bar. All you have to do is setUndecorated(true). This will remove title bar and you can place your custom title bar.

Jump to Post

All 2 Replies

There is no way u can do this.... You can create ur own title bar by overiding the original title bar. All you have to do is setUndecorated(true). This will remove title bar and you can place your custom title bar.

commented: thanks... how can i create a titlebar with the same look and feel as windows? +0

Well to disable it as in make it no more visible thats a bit hard (maybe impossible) why not add a WindowListener and then have Iconified handler like so:

frame.addWindowListener(new WindowAdapter(){

      public void windowIconified(WindowEvent e){
            frame.setVisible(false);
      }
});

this will react when the JFrame is minimized and make it not possible (make it visible instead if default setVisible(false).

Alternatively you may use a JDialog but that lacks a in-built maximize button

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.