URL imageurl;
imageurl = this.getClass().getResource(
"/gnu/classpath/examples/icons/big-warning.png");
img = Toolkit.getDefaultToolkit().createImage(imageurl);
final Canvas ch = new Canvas() {
public void paint(Graphics g) {
g.drawImage(img, xs + 25, ys + 25, this);
Font font = new Font("Serif", Font.PLAIN, 18);
g.setFont(font);
g.setXORMode(Color.red);
g.drawString("Hi Red!", xs + 15, ys + 10);
g.setColor(Color.blue);
g.drawLine(xs, ys, xs + 100, ys + 100);
}
};
ch.setSize(150, 150);
add(ch, "Center");
final ScrollPane sp = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS);
final Panel p = new Panel();
p.add(new Button("Stop"));
p.add(new Button("evil"));
p.add(new Button("hoarders"));
p.add(new Button("use"));
p.add(new Button("GNU!"));
sp.add(p);
add(sp, "South");
Panel east_panel = new Panel();
east_panel.setLayout(new GridLayout(0, 1));
CheckboxGroup group = new CheckboxGroup();
Checkbox cb = new Checkbox("one", group, true);
east_panel.add(cb);
cb = new Checkbox("two", group, false);
east_panel.add(cb);
add(east_panel, "East");
final Button wb = new Button();
wb.setLabel("Hello World!");
wb.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
l.setText("Hello World!");
final Dialog d = new Dialog(parent);
d.setLayout(new FlowLayout());
d.setModal(true);
Button b = new Button("foobar");
b.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent me) {
d.setVisible(false);
}
});
d.add(b);
List ch = new List();
ch.add("Ding");
ch.add("September");
ch.add("Red");
ch.add("Quassia");
ch.add("Pterodactyl");
d.add(ch);
d.pack();
d.setVisible(true);
}
});
wb.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
xs++;
ys++;
ch.repaint();
}
});
add(wb, "West");