diff examples/gui/awt/LightS.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/LightS.java	Fri Apr 05 16:26:00 2019 +0100
@@ -0,0 +1,43 @@
+// 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());
+	}
+}
\ No newline at end of file