• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Prevent JFrame from minimizing

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 77275
371
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 22716
129
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic