X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=apps%2FAntiTheft%2Fjava%2FBagPanel.java;h=4e2e3fe0b9bbd3bfc29da4a75951554f2124a115;hb=a5d1f46daccf4be4e1d0be1a4cf77c5d95bbea03;hp=20e340a372fabf10ce2bafa666134565b5b61d1f;hpb=3121f30fd7ebcc993ce2910da6ed489aa1f0d591;p=tinyos-2.x.git diff --git a/apps/AntiTheft/java/BagPanel.java b/apps/AntiTheft/java/BagPanel.java index 20e340a3..4e2e3fe0 100644 --- a/apps/AntiTheft/java/BagPanel.java +++ b/apps/AntiTheft/java/BagPanel.java @@ -29,12 +29,19 @@ public class BagPanel extends JPanel { GridBagLayout bag; GridBagConstraints c; + /* Create a panel with a bag layout. Create some constraints are + users can modify prior to creating widgets - the current constraints + will be applied to all widgets created with makeXXX */ public BagPanel() { bag = new GridBagLayout(); setLayout(bag); c = new GridBagConstraints(); } + /* The makeXXX methods create XXX widgets, apply the current constraints + to them, and add them to this panel. The widget is returned in case + the creator needs to hang on to it. */ + public JButton makeButton(String label, ActionListener action) { JButton button = new JButton(); button.setText(label); @@ -71,10 +78,11 @@ public class BagPanel extends JPanel { return tf; } - public void addSeparator(int axis) { + public JSeparator makeSeparator(int axis) { JSeparator sep = new JSeparator(axis); bag.setConstraints(sep, c); add(sep); + return sep; } }