diff options
author | pjain <pjain@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-04-07 18:12:58 +0000 |
---|---|---|
committer | pjain <pjain@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-04-07 18:12:58 +0000 |
commit | 28fdfa0225c92310a6f0d60f0cf8c334380e0828 (patch) | |
tree | ba4b0a7a26bf46ea298496a434496695db55bdc1 /java/gjt/CardPanel.java | |
parent | 9c4a1450aec6c149f6491194a48f34a57ed4c39b (diff) | |
download | ATCD-28fdfa0225c92310a6f0d60f0cf8c334380e0828.tar.gz |
Added gjt to CVS
Diffstat (limited to 'java/gjt/CardPanel.java')
-rw-r--r-- | java/gjt/CardPanel.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/java/gjt/CardPanel.java b/java/gjt/CardPanel.java new file mode 100644 index 00000000000..c2ab1a9033c --- /dev/null +++ b/java/gjt/CardPanel.java @@ -0,0 +1,48 @@ +package gjt; + +import java.awt.*; + +/** + * CardPanel employs a BorderLayout to lay out North and Center + * panels; extensions of CardPanel must implement + * Component viewSelector(). The component returned from + * Component viewSelector() is centered in the North panel, and + * should contain UI controls that allow selection of the + * component to be displayed in the Center panel.<p> + * + * @version 1.0, Apr 1 1996 + * @author David Geary + * @see IconCardPanel + * @see ChoiceCardPanel + * @see gjt.test.ChoiceCardPanelTest + * @see gjt.test.IconCardPanelTest + */ +public abstract class CardPanel extends Panel { + private Panel north, center; + private CardLayout cards; + + abstract public Component viewSelector(); + + public CardPanel() { + center = new Panel(); + north = new Panel(); + + setLayout(new BorderLayout()); + center.setLayout(cards = new CardLayout()); + north.setLayout (new BorderLayout()); + + add("North", north); + add("Center", center); + } + public void addNotify() { + super.addNotify(); + north.add("Center", viewSelector()); + north.add("South", new Separator()); + } + protected void addView(String name, Component component) { + center.add(name, component); + } + protected void showView(String name) { + cards.show(center, name); + } +} |