Mercurial > hg > jslab
diff examples/gui/awt/tester.java @ 8:5e3cbbf173aa tip
Reorganise some more
author | samer |
---|---|
date | Fri, 05 Apr 2019 22:41:58 +0100 |
parents | 243687520bcc |
children |
line wrap: on
line diff
--- a/examples/gui/awt/tester.java Fri Apr 05 21:52:03 2019 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* - * AppletBorders.java - * - * Copyright (c) 2000, Samer Abdallah, King's College London. - * All rights reserved. - * - * This software is provided AS iS and WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - */ -package test; -import samer.core.*; -import samer.core.util.*; -import samer.core.util.heavy.*; -import samer.core.util.heavy.Borders.*; -import samer.core.util.Tools; -import java.awt.*; - -public class tester -{ - public static void main(String args[]) - { - new samer.core.shells.AWTShell(); - - final Shell.Window win=Shell.getWindow("tester"); - - win.container().setBackground(Color.white); - // win.container().setForeground(Color.white); - - win.container().setLayout(new StackLayout(0)); - win.container().add(Shell.createLabel("hmmm...")); - win.container().add(createBlock(new Color(200,160,180), "the world")); - win.container().add(createBlock(new Color(200,180,160), "welcome to")); - win.container().add(createBlock(new Color(180,200,160), "i like")); - win.container().add(createBlock(new Color(160,200,180), "of borders")); - win.container().add(createBlock(new Color(160,180,200), "these colours")); - win.container().add(createBlock(new Color(180,160,200), "hello there!")); - win.expose(); - - Agent agent=new Agent() { - public void getCommands(Agent.Registry r) { r.add("repaint"); } - public void execute(String cmd, Environment env) { - if (cmd.equals("repaint")) { - win.container().repaint(); - } - } - }; - Shell.exposeCommands(agent); - Shell.registerAgent(agent); - } - - static Border.Interface border = new CompoundBorder( - new ParentBgBorder(12), - new RoundedBorder(3,26,3) { - protected Color getDefaultColor(Component c) { - return c.getBackground().darker(); // brighter(); - } - } - ); - - static Component createBlock(Color bg, String msg) - { - JPanel p1=new JPanel(border); - p1.setLayout(new FlowLayout()); - p1.setBackground(bg); - p1.setForeground(bg.darker().darker().darker()); - p1.add(Shell.createLabel(msg)); - return p1; - } -}