• 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
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JFrame not fitting to screen.

 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello friends,

I want to make a jframe which is the top level window with a menu bar. It is going to be the first screen of my project. I want that when the program is executed the window is opened in complete screen.

I have rummaged places for it but cant find how it can fit the complete screen when opened. Definitely setSize(int w,int h) dont help.

Moreover, if you can tell, how the same effect can be obtained in netbeans.

Kindly help.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you just mean you want the JFrame maximized (not full screen) then do this after the call to setVisible(true)....

frame.setExtendedState(JFrame.MAXIMIZED_BOTH);

API.

If you mean you want full screen mode read this.
 
Anand Shrivastava
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Greg. It works.

However, i find it extremely tedious to write GUI in Java. Can you suggest some alternative by which the project can be made quickly and at the same time i can learn java.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Anand Shrivastava:
Can you suggest some alternative by which the project can be made quickly and at the same time i can learn java.



Well, that's the million dollar question isn't it. You can always use a tool like Netbeans which has a GUI builder but that won't help you learn Java. That will help you learn how to use Netbeans. You don't have to write Swing code to learn Java either.

Personally, I'd rather write it all myself anyway so I am more anti code generation tools than most folks anyway.
 
reply
    Bookmark Topic Watch Topic
  • New Topic