• Post Reply Bookmark Topic Watch Topic
  • New Topic

JFrame not fitting to screen.

 
Anand Shrivastava
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • 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.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!