Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Prevent JFrame from minimizing  RSS feed

 
hiren parghi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,

I have an applet and from Applet i am creating JFrame.
But whenever JFrame opens its minimized automatically.
I have put nothing to minimize JFrame.
I want JFrame in normal state(not minimized) at the top of all windows.
I tried setState(JFrame.NORMAL), show() methods but then also its minimized automatically.

So please help me to prevent JFrame fro mminimizing.

thanks in advance.
 
Campbell Ritchie
Sheriff
Posts: 53774
128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please check the naming policy, and change your display name to show your full second name.

Don't use the show() method. Look in the API for JFrame to find what you ought to use instead.

There are methods like setResizable, setMaximizable, alwaysOnTop, so if you go through the JFrame API you will find all sorts of things which should fulfill your requirements.

BTW: You may find what you are looking for under "inherited from XYZ" so look right down the API web page before you give up. I can't seem to find a method which prevents you minimising a JFrame. Maybe you will have more luck than me.
 
Rob Spoor
Sheriff
Posts: 20895
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want JFrame in normal state(not minimized) at the top of all windows.

So you want a modal window, being on top of all other windows in your application? And it should not be minimizable?

Then perhaps you need a JDialog instead of a JFrame. If you initialize the dialog with the parent frame, an optional title and "true" to indicate it should be modal, then your application will not allow any input until this dialog is closed.

As for how to get the parent frame, the following code works for all components, including Applet (and JApplet):

For Applets (and JApplets), this returns some Sun internal class that denotes the frame used inside the browser.


Actually, the above code can be more generic:
If you call this as "getParent(c, Frame.class)" you can also get the parent frame, but it can be used to get the parent of any class you want.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!