The wizard contains the following fields:
See also:
Creating and using Dialogs
Making a Bean from a Dialog
But, even without making your dialog into a bean, you can create it and use it in JBuilder.
Even if you are not initially making your dialog into a bean, you will find useful topics in Making a Bean from a Dialog for adding properties and events to your dialog, such as properties for result codes and user entered values, and aggregated events for buttons.
For a modeless dialog (which we are calling dialog1
in this example), you can use the form of the constructor that takes a single parameter (the parent Frame) as follows:
Dialog1 dialog1=new Dialog1(this);
For a modal dialog, you will need to use a form of the constructor that has the boolean modal parameter set to true
, such as in the following example:
Dialog1 dialog1=new Dialog1(this, true);
You can either place this line as an instance variable at the top of the class (in which case the dialog will be instantiated during the construction of your Frame and be reusable), or you can place this line of code in the actionPerformed event handler for the button that invokes the dialog (in which case a new instance of the dialog will be instantiated each time the button is pressed.) Either way, this line instantiates the dialog, but does not make it visible yet.
(In the case where the dialog is a bean, you must set its frame property to the parent frame before calling show(), rather than supplying the frame to the constructor.)
dialog1.show();
To see examples of using modal dialog components (dialogs that have been wrapped as Beans, with default constructors), see the TextEdit tutorial.