Java Reference
In-Depth Information
Figure 3-15. Layout of the setting form's components
Adding Actions to Wire the User Interface
Follow these steps to wire up the user interface:
1. Return to the WeatherXlet editor by selecting the WeatherXlet tab. Right-click
the Settings button, and add an event by choosing Events Action
actionPerformed. The code editor will open. Add the snippet in Listing 3-3 to
the actionPerformed method.
Listing 3-3. The actionPerformed Method for the Settings Button
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
org.jdesktop.layout.GroupLayout layout =
(org.jdesktop.layout.GroupLayout)getContentPane().getLayout();
layout.replace( jPanel1, new SettingPanel());
}
2. Return to the Design view and add the actionPerformed event handler, shown in
Listing 3-4, to the Exit button.
 
Search WWH ::




Custom Search