Step by Step Instructions for Creating Your First Java Application in NetBeans8.0
- Choose File / New Project. Under Categories, select
Java. Under Projects, select Java Class Library. Click Next.
- Under Project Name, enter the
name of your application. Change the Project Location to any folder
on your computer.
- Click Finish. The IDE creates
the project folder.
- Right-click the project node
in the Projects window or Files window and
select New > Other. Under Categories, select Swing GUI Forms. Under
File Types, select JFrame Form. Click Next.
- Under Class Name, enter a
name for your class. Leave Package blank for now (default package).
- Click Finish. The IDE creates
the JFrame form in the specified package. The Form opens in the Design
editor.
- IMPORTANT: Right
click your JForm's background panel (not on any component or embedded
panel) and choose "Set Layout..." on the pop-up menu, then select
"Absolute Layout".
- Add several components (click
component, click on design panel; OR right-click on design panel and
choose Add From Palette).
- Repeat step 7 as necessary
(see below for instructions for specific components).
- To Run - Right click on
Projects.../<formname>.java select
Run File (or SHIFT-F6)
What to turn in
Zip your netbeans project directory and email, along with a screenshot of the app running, to is4300f16@css.neu.edu
Component-specific Instructions
to add icon images to buttons or labels
(to get automatically bundled in the JAR file)
1. Copy
GIF or JPG to \src directory.
2. Select
icon... property of component.
3. Click
down arrow next to icon... property (or click "Image within project"
radio button, the "..." button, and select the desired image
from the pull-down menu).
to populate a JComboBox
1. First
add the combo box to the panel. Then edit the 'model' property.
to add a Menu
1.
First add a MenuBar to the JForm.
2.
Right click on the JMenuBar object in the
Inspector, and select Add Menu (to add another menu.
3. To
add items to a menu, expland the JMenuBar
object in the Inpector, right click on the JMenu, choose Add From Palette > Menu Item
to add a nested JPanel
1.
Add the Panel to Display.
2. Right click on the Panel and set the Layout to Absolute.
3.
Add contained components.