Using NetBeans for Lab 5.docx

moodusroundoSoftware and s/w Development

Aug 15, 2012 (5 years and 11 months ago)


Brief Notes on Using NetB
eans for Lab 5

I demoed how to go about creating the actual UI in the lab on the 20
. I was going to post the code,
then realized how close it was to the actual assignment. So I created something similar.

How it Works

There are 3 classes.


Main is used to start the other two classes, though the other two are testable individually. The
sequence is: Create a new JFrame and a new Dialog. Make the dialog visible as a modal dialog
with the JFrame as the parent. The

dialog then sets a number of internal member variables
that can be retrieved later at any point in time.

When the dialog is dismissed, the main program launches the JFrame.


The Dialog box is designed by employing the following steps:


Right click
on the project, select New | Other... | Swing GUI Forms | JDialog

this will
put you in design mode.


From the Palette drag over the necessary buttons, labels and textFields to design the


Right click on the controls and change the variable names a
nd any displayed text to fit
the needs of the application.


Double click each of the buttons to generate an

method and insert
the code for each button.


You can explore the CENG513GuiDemo using the same technique. |


The JFrame is desi
gned in much the same way


Note how text is extracted from one type of control and moved into another, especially
the combo box.


To clear the combo box in your design, go to the Properties palette and modify the


Note: the project could h
ave been designed with just the JFrame and the Dialog, however
starting it from Main was easier to explain.

How to start the project

Just download the zip file and extract the files. Start up NetBeans. Select Open Project and
navigate to the directo
ry where you unzipped the files. The main directory will appear as a
project. then just run it.