Some small enhancements from Mark.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@2562 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
samskivert
2009-05-28 00:13:22 +00:00
parent 926f242b32
commit 04637df95c
@@ -21,6 +21,7 @@
package com.samskivert.swing; package com.samskivert.swing;
import java.awt.EventQueue; import java.awt.EventQueue;
import java.awt.LayoutManager;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@@ -61,6 +62,15 @@ public class CollapsiblePanel extends JPanel
this(new JButton(triggertext)); this(new JButton(triggertext));
} }
/**
* Create a collapsible panel to which the trigger button will be
* added later.
*/
public CollapsiblePanel (LayoutManager layout)
{
setLayout(layout);
}
/** /**
* Create a collapsible panel to which the trigger button will be * Create a collapsible panel to which the trigger button will be
* added later. * added later.
@@ -88,6 +98,14 @@ public class CollapsiblePanel extends JPanel
* Set a component which contains the trigger button. * Set a component which contains the trigger button.
*/ */
public void setTriggerContainer (JComponent comp, JPanel content) public void setTriggerContainer (JComponent comp, JPanel content)
{
setTriggerContainer(comp, content, true);
}
/**
* Set a component which contains the trigger button.
*/
public void setTriggerContainer (JComponent comp, JPanel content, boolean collapsed)
{ {
// these are our only two components. // these are our only two components.
add(comp); add(comp);
@@ -112,7 +130,7 @@ public class CollapsiblePanel extends JPanel
}); });
// and start us out not showing // and start us out not showing
setCollapsed(true); setCollapsed(collapsed);
} }
/** /**