Java Reference
In-Depth Information
L ISTING 11.10 Continued
import java.awt.*;
/**
* Chapter 11 A test application
* @author Mauro Marinilli
* @version 1.0
*/
public class AnApplication extends JFrame {
JPanel centerPanel = new JPanel();
JButton pasteButton = new JButton();
JLabel southLabel = new JLabel();
JLabel centerLabel = new JLabel();
JPanel northPanel = new JPanel();
JNLPLabel northLabel = new JNLPLabel();
JButton openFileButton = new JButton();
public AnApplication() {
setTitle(Utilities.getMsg(“title”));
setIconImage(Utilities.getImageIcon(“bubu”).getImage());
this.getContentPane().setLayout(new BorderLayout());
this.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
centerPanel.setLayout(new BorderLayout());
pasteButton.setText(“Paste”);
pasteButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
centerLabel.setText(pasteClipboardContent());
}
});
southLabel.setText(Utilities.getMsg(“hello”));
centerLabel.setIcon(Utilities.getImageIcon(“anIcon.gif”));
northLabel.setText(“please click here!”);
northLabel.setURL(“http://server/b2/index.html”);
openFileButton.setIcon(Utilities.getImageIcon(“open.gif”));
openFileButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
openFile();
}
});
this.getContentPane().add(centerPanel, BorderLayout.CENTER);
centerPanel.add(pasteButton, BorderLayout.EAST);
centerPanel.add(centerLabel, BorderLayout.CENTER);
centerPanel.add(northPanel, BorderLayout.NORTH);
Search WWH ::




Custom Search