Hi All, I am developing a Java application and I am using netbeans for the GUI. I have a main window for which I used a JFrame class and I have a menu in that. When the user clicks that menu item, I want a modal dialog to open. I want to have a number of buttons on that dialog to get a "logic formula" as input from the user. Its difficult to manually write code for this dialog box. So I wanted to do this using Netbeans. But I dont know how to create a class for a dialog box in Netbeans. I am able to create another JFrame class. But using this a dialog seems to be problematic since closing that frame closes the whole application.
When I try to add something new to my project, i am given only the following options - Java class, JFrame form, JPanel form, Java Package, Java interface and web service client.
Can somebody explain the process of adding a JDialog as a stand alone class so that I add buttons to that dialog using the netbeans front end and then I can create an object of this class when the user clicks on the particular menu item.
Thanks a lot in advance.
Joined: Jul 07, 2005
Hi Easwar, First of all, get the latest stable release of Netbeans, i.e., version 5.5. If you are already having this version then follow the steps below:
1. Create a new project in netbeans. 2. Go to menu File > New File ( or alternately press Ctrl - N ) 3. In the dialog box that appears, notice that in the left hand side you have a list of categories, select Java GUI Forms in the category list. 4. Notice that the right hand list now changes to show you the available form types. You must have a type called JDialog form available in the right hand side list. Select this and press next! 5. Fill in the details in the next page and Voila! The GUI editor of Netbeans called Matisse now opens up for you with the JDialog that you want to create.