This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Minimize button in JFrame Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Minimize button in JFrame" Watch "Minimize button in JFrame" New topic
Author

Minimize button in JFrame

NIKHIL EROS
Greenhorn

Joined: Sep 21, 2001
Posts: 17
after exploring java docs, i could learn how to disable the close button on JFrame, but i could not get anywhere as "How to disable the minimize button on JFrame" ??
can anbody please guide me the way to achieve that?
Guennadiy VANIN
Ranch Hand

Joined: Aug 30, 2001
Posts: 898
I shall try to tell my understanding (it is not an absolute truth):
"The delegation event model is more selective, delivering events only to components that indicate interest in the particular type of event by calling enableEvent(long) or adding a listener to the component."
Window.WINDOW_ICONIFIED event happens without any listener adding. It is because it is OS event, external to application. It is possible to mask/identify it, but not to prevent.
It is possible to catch iconization event but post-factum (minimization already happened) by

and try to de-iconify then.
How to de-iconify? You should to communicate with external world/OS and solution will not be portable... I even do not know your OS...
Any other opinions?
Guennadiy VANIN
Ranch Hand

Joined: Aug 30, 2001
Posts: 898
There was similar but more active discussion earlier in this forum: http://www.javaranch.com/ubb/Forum2/HTML/002907.html
Guennadiy VANIN
Ranch Hand

Joined: Aug 30, 2001
Posts: 898
Having a (J)Dialog owned by your (Frame/JFrame) frame, will prevent minimization (but that dialog will be always on top and you may not even make it of "zero" size, peer's menubar, sorry taskbar, with close button will always show up:
<pre>
import java.awt.*;
import javax.swing.*;
public class TestDesactivateMinimize
{
public static void main (String args[])
{
javax.swing.JFrame frame = new javax.swing.JFrame ("JFrame");
//frame.pack();
JDialog diag = new JDialog (frame, "JDialog", true);
frame.setSize(200, 500);
frame.setLocation(500, 300);
frame.setVisible (true);
frame.show();
diag.show();
}
}
</pre>

[This message has been edited by G Vanin (edited November 23, 2001).]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Minimize button in JFrame
 
Similar Threads
disabling minimize icon in JFrame
How do you maximize on frame load?
Disabling minimize and maximie button
JFrame disable minimize button (jdk1.3)
how to disable minimize option in JFrame