Construct the object including its GUI
super("ChartTest");
setLayout(new FlowLayout());
add(new Label("Simple demo of a Java Chart Bean"));
add(quitButton = new Button("Exit"));
quitButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setVisible(false);
dispose();
System.exit(0);
}
});
add(drawButton = new Button("Draw"));
drawButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
bean.doDemo();
}
});
add(bean = new Chart("System Usage in 1999"));
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
setVisible(false);
dispose();
System.exit(0);
}
});
pack();