Mercurial > hg > jslab
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/gui/awt/Light.java Fri Apr 05 16:26:00 2019 +0100 @@ -0,0 +1,42 @@ +// program to test lightweight components +package test.awt; + +import java.awt.*; +import java.awt.event.*; +import java.applet.*; + + +public class Light extends Applet +{ + public static void run(Container c) + { + c.setLayout(new FlowLayout()); + c.add( new Button("Hello!")); + c.add( new Lightweight(Color.green,"harpo")); + c.add( new Lightweight(Color.blue,"groucho")); + c.add( new Lightweight(Color.red,"zeppo")); + c.validate(); + } + + public static void main(String[] args) + { + Frame fr=new Frame("Lightweight test"); + fr.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + System.exit(0); + } + } ); + fr.setSize(400,100); + fr.show(); + run(fr); + } + + public void init() + { + setBackground( Color.black); + setForeground( Color.yellow); + getParent().setBackground( Color.red); + run(this); + } + +} \ No newline at end of file