Java Reference
In-Depth Information
public void setSettingPanel( JPanels){
settingPanel = s;
}
public void showMainPanel() {
layout.replace( settingPanel, mainPanel );
xlet.pack();
}
public void showSettingPanel() {
layout.replace( mainPanel, settingPanel );
xlet.pack();
}
}
2. Add the instance variables shown in Listing 3-8 to WeatherXlet .
Listing 3-8. Declarations in WeatherXlet to Support the Controller
private WeatherController controller;
private javax.swing.JPanel jPanel2;
3. Change WeatherXlet 's constructor to read as shown in Listing 3-9.
Listing 3-9. Revising WeatherXlet's Constructor to Support the Controller
public WeatherXlet() {
initComponents();
controller = new WeatherController( this );
jPanel2 = new SettingPanel( controller );
controller.setMainPanel( jPanel1 );
controller.setSettingPanel( jPanel2 );
}
Tip Don't actually compile this code yet; you need to make the changes to the constructor in step 6
before your code is complete. You'll get an error if you attempt to build this code now.
 
Search WWH ::




Custom Search