Java Reference
In-Depth Information
L ISTING 10.4 Continued
}
});
setSize(400,300);
setVisible(true);
}
private void showDrawEditor() {
DrawEditor de = new DrawEditor(this);
}
private JToolBar getToolBar() {
JToolBar jt = new JToolBar();
drawButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
showDrawEditor();
}
});
drawButton.setText(“draw”);
otherButton.setText(“other”);
anotherButton.setText(“open”);
this.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
jt.add(anotherButton);
jt.add(otherButton);
jt.add(drawButton);
return jt;
}
private void exit() {
System.exit(0);
}
public static void main(String[] a) {
LazyEditor led = new LazyEditor();
}
}
Note in Listing 10.4 that when the “draw” button is activated, the DrawEditor class is created
for managing the drawing plug-in.
The DrawEditor class is illustrated in Listing 10.5.
Search WWH ::




Custom Search