diff options
author | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-10-23 05:41:21 +0000 |
---|---|---|
committer | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-10-23 05:41:21 +0000 |
commit | 0b14259f78e5a4f6953102c0341e6080469522ac (patch) | |
tree | 9d86a5255c27f30965f4ac0847a99a1732ce8522 /java/gjt/test/RubberbandTest.java | |
parent | d469dc67d4d65170cd1e0c1b872e9eda28459e73 (diff) | |
download | ATCD-TAO-0_2_33.tar.gz |
This commit was manufactured by cvs2svn to create tag 'TAO-0_2_33'.TAO-0_2_33
Diffstat (limited to 'java/gjt/test/RubberbandTest.java')
-rw-r--r-- | java/gjt/test/RubberbandTest.java | 112 |
1 files changed, 0 insertions, 112 deletions
diff --git a/java/gjt/test/RubberbandTest.java b/java/gjt/test/RubberbandTest.java deleted file mode 100644 index ae256fb2c3a..00000000000 --- a/java/gjt/test/RubberbandTest.java +++ /dev/null @@ -1,112 +0,0 @@ -package gjt.test; - -import java.awt.*; -import gjt.DrawingPanel; -import gjt.Separator; -import gjt.RowLayout; -import gjt.rubberband.*; - -/** - * A simple drawing applet that demonstrates the utility of - * the gjt.rubberband package.<p> - * - * Note that this unit test also serves as the unit test for - * gjt.DrawingPanel.<p> - * - * @version 1.0, April 25, 1996 - * @author David Geary - * @see gjt.test.UnitTest - * @see gjt.DrawingPanel - * @see gjt.rubberband.Rubberband - * @see gjt.rubberband.RubberbandLine - * @see gjt.rubberband.RubberbandRectangle - * @see gjt.rubberband.RubberbandEllipse - * @see gjt.rubberband.RubberbandPanel - */ -public class RubberbandTest extends UnitTest { - public String title() { - return "Rubberband Test"; - } - public Panel centerPanel() { - return new RubberbandTestPanel(); - } -} - -class RubberbandTestPanel extends Panel { - private DrawingPanel drawingPanel; - private ChoicePanel choicePanel; - - public RubberbandTestPanel() { - drawingPanel = new DrawingPanel(); - choicePanel = new ChoicePanel(drawingPanel); - - setLayout(new BorderLayout()); - add("North", choicePanel); - add("Center", drawingPanel); - } -} - -class ChoicePanel extends Panel { - private DrawingPanel drawingPanel; - private Color color; - private Checkbox fillCheckbox = new Checkbox(); - - public ChoicePanel(DrawingPanel drawingPanel) { - Panel choicePanel = new Panel(); - Choice geometricChoice = new Choice(); - Choice colorChoice = new Choice(); - - this.drawingPanel = drawingPanel; - - geometricChoice.addItem("Lines"); - geometricChoice.addItem("Rectangles"); - geometricChoice.addItem("Ellipses"); - - colorChoice.addItem("Black"); - colorChoice.addItem("Red"); - colorChoice.addItem("Blue"); - colorChoice.addItem("Gray"); - colorChoice.addItem("White"); - - choicePanel.setLayout(new RowLayout(10)); - choicePanel.add(new Label("Shape:")); - choicePanel.add(geometricChoice); - choicePanel.add(new Label("Color:")); - choicePanel.add(colorChoice); - choicePanel.add(new Label("Fill:")); - choicePanel.add(fillCheckbox); - - setLayout(new BorderLayout()); - add("Center", choicePanel); - add("South", new Separator()); - } - public boolean action(Event event, Object what) { - if(event.target instanceof Checkbox) { - drawingPanel.setFill(fillCheckbox.getState()); - } - else if(event.target instanceof Choice) { - if(((String)what).equals("Lines")) { - fillCheckbox.setState(false); - drawingPanel.drawLines(); - } - else if(((String)what).equals("Rectangles")) { - System.out.println("Rectangles"); - drawingPanel.drawRectangles(); - } - else if(((String)what).equals("Ellipses")) - drawingPanel.drawEllipses (); - else if(((String)what).equals("Black")) - drawingPanel.setColor(Color.black); - else if(((String)what).equals("Red")) - drawingPanel.setColor(Color.red); - else if(((String)what).equals("Blue")) - drawingPanel.setColor(Color.blue); - else if(((String)what).equals("Gray")) - drawingPanel.setColor(Color.gray); - else if(((String)what).equals("White")) - drawingPanel.setColor(Color.white); - } - return true; - } - public Insets insets() { return new Insets(5,0,5,0); } -} |