Java Reference
In-Depth Information
Frame frame;
int clicks = 0;
ImageButton button;
public ImageTest() {
frame = new Frame("ImageButton Test");
button = new ImageButton
(Toolkit.getDefaultToolkit().getImage ("logo.png"),
"logo");
button.addActionListener(this);
frame.add(button, BorderLayout.CENTER);
frame.pack();
}
public void actionPerformed(ActionEvent ae) {
frame.setTitle ("clicks: " + (++clicks));
}
public void startApp() {
frame.show();
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
notifyDestroyed();
}
}
Figure 4.9 shows the ImageTest application containing the ImageButton component created in
this section.
Figure 4.9. The ImageTest application for testing the ImageButton component.
Switching Layouts Depending on the Screen Resolution Available
 
 
 
Search WWH ::




Custom Search