Mercurial > hg > jslab
view examples/gui/awt/LightS.java @ 5:b67a33c44de7
Remove some crap, etc
author | samer |
---|---|
date | Fri, 05 Apr 2019 21:34:25 +0100 |
parents | 5df24c91468d |
children |
line wrap: on
line source
// program to test lightweight components (Swing version) package test.awt; import java.awt.*; import java.awt.event.*; import javax.swing.*; // this is a lightweight component public class LightS extends JApplet { public static void run(Container c) { JButton b = new JButton("Hello!"); c.setLayout(new FlowLayout()); c.add( b); 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) { JFrame fr=new JFrame("Lightweight test"); fr.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } } ); fr.setSize(400,100); fr.show(); run(fr.getContentPane()); } public void init() { getParent().setBackground( Color.red); run(getContentPane()); } }