• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Minimize button in JFrame

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 898
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 898
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There was similar but more active discussion earlier in this forum: http://www.javaranch.com/ubb/Forum2/HTML/002907.html
 
Guennadiy VANIN
Ranch Hand
Posts: 898
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 looks like it's time for me to write you a reality check! Or maybe a tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic