/**
* Status bar component that can be added to the {@link BorderLayout#SOUTH} area
* of a {@link JFrame}’s {@link JFrame#getContentPane() content pane}.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
- * @version $Id$
*/
/* TODO - make it possible to add further components. */
public class StatusBar extends JPanel {
/**
* Sets the text of the label.
- *
+ *
* @param text
* The text of the label
*/
/**
* Adds a side component to the right side of the status bar, pushing all
* previously added side components to the left.
- *
+ *
* @param component
* The component to add
*/
sideComponents.add(component);
int newIndex = sideComponents.size();
add(component, new GridBagConstraints(newIndex, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 2, 0, 0), 0, 0));
+ validate();
}
/**
* Returns the number of side components.
- *
+ *
* @return The number of side components
*/
public int getSideComponentCount() {
/**
* Returns all side components in order.
- *
+ *
* @return All side components
*/
public List<Component> getSideComponents() {
/**
* Removes the side component with the given index.
- *
+ *
* @param sideComponentIndex
* The index of the side component to remove
*/
public void removeSideComponent(int sideComponentIndex) {
Component sideComponent = sideComponents.remove(sideComponentIndex);
remove(sideComponent);
+ validate();
}
/**
* Removes the given side component.
- *
+ *
* @param sideComponent
* The side component to remove
*/
public void removeSideComponent(Component sideComponent) {
sideComponents.remove(sideComponent);
remove(sideComponent);
+ validate();
}
}