• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Opening a JFrame maximized

 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
i was wondering if there was an option so that the JFrame for any java application be opened in a maximised position.
Can anybody help in this regard?
Amit
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi There,
You can achieve your functionality by setting the size of the JFrame(setSize(Dimension d)).
Use this Method of JFrame as setSize(Dimension dim), pass the Dimension object in this method. Before this create the Dimension object in this way.
JFrmae frame=new JFrame();
Dimension dim=new Dimension(Toolkit.getScreenSize());
frame.setSize(dim);
This will create your JFrame of your screenSize i.e maximized.
I hope this will solve your problem....
Bye..
 
Amit Agarwal
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sanjay,
using the above code i will get a frame which is of the full screen size. i am working on the windows platform, and when i want to maximize, i want to take into consideration the windows taskbar(start menu). that is, the maximize should work the same way as would a normal windows application.
also, if a user clicks on the maximize icon on the frame, i get the desired result. i want to get the same result from an event generated thru the program itself.
------
Amit
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to use JNI to do this. JDJ has written several articles on how this can be accomplished, and in fact, there is a utility called JUtil that you can download to make this stuff easy. Check it out.
 
But how did the elephant get like that? What did you do? I think all we can do now is read this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic