import java.awt.* ; class Simple extends Frame { Simple (String title) { super(title) ; Panel p = new Panel () ; p.add(new LabelColor (Color.red, "La rouge")) ; p.add (new Label("et")) ; p.add(new LabelColor (Color.yellow, "la jaune")) ; add(p) ; setSize(100,100) ; setLocation(100,100) ; show() ; } public static void main (String[ ] args) { Simple f = new Simple("Simple") ; } } class LabelColor extends Label { LabelColor (Color c, String txt) { super(txt) ; setBackground(c) ; } } |