First, NetBeans design graphical user interface Step 1
1. Directly create JFrame class: Right-click "Package" | new | JFrame form
2. Redefine class name-form class Loginframe
Click Finish to open Design view
Code view
Second, the NetBeans design graphical user interface Step 2
1. Set form Properties
Select Form | Set the values of each property of a form in the Properties panel
Common Properties
Title: Set the caption bar of the form
Resizable: Set whether the form can be resized (depending on the situation)
Defaultcloseoperation: Set form close mode
2. Set the form layout
Right-click the form--Set layout--Select layout mode
The default is free layout
Third, the NetBeans design graphical user interface Step 3
1. Add components and set component properties and variable names
Example 1: Add a label JLabel
property settings
Text: Label text (another: Right-click Label-Edit text)
Font: Format for fonts
Foreground: Font Color
Change variable name (object name)
Right-click Label | Change the name of a variable
Label variable name: Lblusername
Example 2: Adding a text field
property settings
Columns: Number of initial columns of text field
Text: Literal field initial value
Editable: Whether you can edit
Change variable name (object name)
Right-click the Text field | Change the name of a variable
Text field variable name: txtUserName
Example 3: Add a button
property settings
Text: Button text
Font: Button text Format
Foreground: Font Color
Change variable name (object name)
Right-click Button | Change the name of a variable
Button variable Name: Btnlogin
Iv. NetBeans Design Graphical user interface Step 4
V. NetBeans design graphical user interface Step 5
1. Event handling (Take the button as an example)
Method 1: Right-click the button | Events | Action | Actionperformed
Method Two: Double-click the button
2. Write Event handling code