Results 1 to 1 of 1
- 06-19-2010, 02:45 AM #1
Member
- Join Date
- Jan 2010
- Location
- Russia
- Posts
- 9
- Rep Power
- 0
Showing NetBeans-generated Swing forms
I want to make a GUI project with several forms. I've created a desktop application, and there're 3 classes: main application class, main window, and About box. Only the application class has main method.
Now I want to add a new form which will be shown after a button click. I create New File -> Swing GUI Forms -> JFrame Form, and I get a new form, with main() method. If I copy the generated code for About box, everything works fine, but I'm confused about what is the proper way to show this form when I click a button.
Code to show About box:
Code of NewJFrame.main():Java Code:public void showAboutBox() { if (aboutBox == null) { JFrame mainFrame = DeskTestApp.getApplication().getMainFrame(); aboutBox = new DeskTestAboutBox(mainFrame); aboutBox.setLocationRelativeTo(mainFrame); } DeskTestApp.getApplication().show(aboutBox); }
Java Code:public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new NewJFrame().setVisible(true); } }); }
Similar Threads
-
How to edit the non-editable code generated by the netbeans ???
By Stephen Douglas in forum NetBeansReplies: 9Last Post: 06-02-2012, 05:04 PM -
How to make online jsp forms from Microsoft word forms in java
By jiten.mistry in forum Advanced JavaReplies: 2Last Post: 04-28-2008, 10:56 AM -
[SOLVED] Navigation between swing forms
By stevedb in forum AWT / SwingReplies: 7Last Post: 04-01-2008, 01:23 PM -
showing the servlets api docs in netbeans
By truegilly in forum New To JavaReplies: 0Last Post: 12-05-2007, 09:14 PM -
Creating Sub forms in java netbeans 5.0
By java_newbie in forum NetBeansReplies: 14Last Post: 08-06-2007, 07:19 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks