Sunday, December 27, 2009

Java Netbean programming: How to make the app window be automatically maximize at run time?

Thanks allJava Netbean programming: How to make the app window be automatically maximize at run time?
In code:


After creating your JFrame, call setExtendedState(JFrame.MAXIMIZED_BOTH) on it. May not work on all platforms, but definitely works with Java 5 on WindowsXP.





In NetBeans form editor:


Make sure the outer JFrame is selected. On the right, you should see that the Properties view shows ';[JFrame]'; on the title bar. About a quarter of the way down you should see a property called ';extendedState';. Click on the ';...'; button to the right, and the editor will pop up. There is no custom editor, so you have to select ';Custom code'; from the combo box. Enter ';javax.swing.JFrame.MAXIMIZED_BOTH'; and then click ';OK';. Unfortunately, this doesn't work all by itself, because the NetBeans form editor always adds ';pack();'; at the end of the auto-generated ';initComponents()'; method. So the best place to do it, as I see it, is to switch to ';Source'; view and edit the run() method inside the main() method. Take your JFrame class (or subclass) and manually call setExtendedState(JFrame.MAXIMIZED_BOTH).





Java Netbean programming: How to make the app window be automatically maximize at run time?
Assuming you are using the form editor, click on the form itself, and in the properties window, there will be an option that should say something like window state, or maximized, or something similar.
  • powder
  • oil offshore
  • oil weight
  • petroleum oil
  • No comments:

    Post a Comment