1

Im trying to create my own Frame for my application. I have removed the standard Frame by using setUndecorated(true). I have a working exit button (not that difficult), but i want to have a JButton equal to the windows-minimizing-button in the top-right corner. I have tried several solutions as hide(), HIDE_ON_CLOSE and even setVisible(). But non of them is giving me the wanted result.

Im extending a JFrame to my class.

I am thinking of some Mouselistener(?), but im like a big question mark right now.

enter image description here

Handsken
  • 664
  • 11
  • 26
  • frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); – mKorbel Oct 12 '11 at 09:18
  • Doesn't work in my case, Im extending a JFrame in my class, and even if i remove frame and just write `setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE)` it still gives me nothing – Handsken Oct 12 '11 at 09:22
  • duplicate https://stackoverflow.com/questions/3965336/how-to-minimize-a-jframe-window-from-java – Hernán Eche Nov 25 '14 at 20:02

1 Answers1

1

http://www.google.com/search?q=jframe+minimize

1st link:

http://java-puzzle.blogspot.com/2009/07/tutorial-to-minimize-jframe-dynamically.html

frame.setExtendedState(JFrame.ICONIFIED);

Alex Abdugafarov
  • 6,112
  • 7
  • 35
  • 59
  • By setting extended state this way you are losing another states of a window. Using `frame.setState(JFrame.ICONIFIED)` for minimizing a window is more preferable according to the [javadocs](http://docs.oracle.com/javase/6/docs/api/java/awt/Frame.html#setState(int)). – cubanacan Sep 12 '12 at 14:05