annotate 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
rev   line source
samer@1 1 // program to test lightweight components
samer@1 2 package test.awt;
samer@1 3
samer@1 4 import java.awt.*;
samer@1 5 import java.awt.event.*;
samer@1 6 import java.applet.*;
samer@1 7
samer@1 8
samer@1 9 public class Light extends Applet
samer@1 10 {
samer@1 11 public static void run(Container c)
samer@1 12 {
samer@1 13 c.setLayout(new FlowLayout());
samer@1 14 c.add( new Button("Hello!"));
samer@1 15 c.add( new Lightweight(Color.green,"harpo"));
samer@1 16 c.add( new Lightweight(Color.blue,"groucho"));
samer@1 17 c.add( new Lightweight(Color.red,"zeppo"));
samer@1 18 c.validate();
samer@1 19 }
samer@1 20
samer@1 21 public static void main(String[] args)
samer@1 22 {
samer@1 23 Frame fr=new Frame("Lightweight test");
samer@1 24 fr.addWindowListener(new WindowAdapter() {
samer@1 25 public void windowClosing(WindowEvent e) {
samer@1 26 System.exit(0);
samer@1 27 }
samer@1 28 } );
samer@1 29 fr.setSize(400,100);
samer@1 30 fr.show();
samer@1 31 run(fr);
samer@1 32 }
samer@1 33
samer@1 34 public void init()
samer@1 35 {
samer@1 36 setBackground( Color.black);
samer@1 37 setForeground( Color.yellow);
samer@1 38 getParent().setBackground( Color.red);
samer@1 39 run(this);
samer@1 40 }
samer@1 41
samer@1 42 }