comparison examples/gui/awt/Light.java @ 1:5df24c91468d

Oh my what a mess.
author samer
date Fri, 05 Apr 2019 16:26:00 +0100
parents
children
comparison
equal deleted inserted replaced
0:bf79fb79ee13 1:5df24c91468d
1 // program to test lightweight components
2 package test.awt;
3
4 import java.awt.*;
5 import java.awt.event.*;
6 import java.applet.*;
7
8
9 public class Light extends Applet
10 {
11 public static void run(Container c)
12 {
13 c.setLayout(new FlowLayout());
14 c.add( new Button("Hello!"));
15 c.add( new Lightweight(Color.green,"harpo"));
16 c.add( new Lightweight(Color.blue,"groucho"));
17 c.add( new Lightweight(Color.red,"zeppo"));
18 c.validate();
19 }
20
21 public static void main(String[] args)
22 {
23 Frame fr=new Frame("Lightweight test");
24 fr.addWindowListener(new WindowAdapter() {
25 public void windowClosing(WindowEvent e) {
26 System.exit(0);
27 }
28 } );
29 fr.setSize(400,100);
30 fr.show();
31 run(fr);
32 }
33
34 public void init()
35 {
36 setBackground( Color.black);
37 setForeground( Color.yellow);
38 getParent().setBackground( Color.red);
39 run(this);
40 }
41
42 }