Mercurial > hg > jslab
view examples/gui/awt/tester.java @ 6:f0fa855432af
Remove stuff
author | samer |
---|---|
date | Fri, 05 Apr 2019 21:49:42 +0100 |
parents | 5df24c91468d |
children |
line wrap: on
line source
/* * 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; } }