Class StatusBar

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible
Direct Known Subclasses:
InfranetStatusBar

public class StatusBar extends JPanel implements ActionListener
Provides ability to control contents of the status bar. The status bar has three main areas:
  • Message area: allows showing textual info or a user-defned panel
  • Progress area: animation showing progress of some activity. The ui components in this area can appear in these combinations
  • Progress bar only
  • Progress bar and counter
  • Progress bar and Cancel button
  • Progress bar and counter and Cancel button
Status and progress messages are set to automatically disappear after a specified time. This time is configurable and defaults to 5 seconds. This status bar also has a gripper to give the visual cue that the parent panel can be resized

See Also:
  • Constructor Details

    • StatusBar

      public StatusBar()
      Default constructor. This builds a status-bar with just a message panel
    • StatusBar

      public StatusBar(boolean showProgressBar)
      This builds a status-bar with a message panel and optionally a progress panel with a progress bar, progress text and a progress cancel button.
      Parameters:
      showProgressBar - if true, displays the progress bar, the progress text(if set) and the Cancel button
    • StatusBar

      public StatusBar(boolean showProgressText, boolean showProgressCancel)
      This builds a status-bar with a message panel and a progress panel with a progress bar and optionally a progress text and a progress cancel button.
      Parameters:
      showProgressText - if true, displays the progress text(if set)
      showProgressCancel - if true, displays the progress Cancel button
  • Method Details

    • init

      protected void init()
    • createEastPanel

      protected JPanel createEastPanel()
      Create an internal panel, positioned using an east layout constaint, to hold optional subpanels such as progress bar, connection info, or user defined panels. etc.

      Gripper panel will always be placed as the last component on this panel.

      Returns:
      mEastPanel.
    • addAsLastComponent

      public void addAsLastComponent(JPanel panel)
      Adds the panel as the last one to the status bar, just before the gripper.

      Panel background will be set to default status bar background.

      Parameters:
      panel - the panel to be set as the last component.
    • createGripperPanel

      protected JPanel createGripperPanel()
      Creates a GripperPanel. A GripperPanel is a panel which paints hatch marks that provide a visual cue that the screen can be resized.
      Returns:
      GripperPanel;
    • createMessagePanel

      protected JPanel createMessagePanel()
      Creates a simple message area with the default layout
      Returns:
      message panel
    • createProgressPanel

      protected JPanel createProgressPanel()
      A simple progress bar implementation
      Returns:
      JPanel
    • actionPerformed

      public void actionPerformed(ActionEvent e)
      Specified by:
      actionPerformed in interface ActionListener
    • setMessage

      public void setMessage(String message)
      Sets the message to display in the message display area of status bar. Message will be truncated if its length is too long; visible length depends on current size of window.
      Parameters:
      message - Message to display.
    • setMessage

      public void setMessage(String message, int visible)
      Sets the message to display in the message display area of status bar. Message will be truncated if its length is too long; visible length depends on current size of window. Message will remain visible for time specified.
      Parameters:
      message - Message to display.
      visible - How long the message should be visible, in seconds. If less than or equal to zero, the default time-out is used
    • addToStatusBar

      public void addToStatusBar(Component c)
      Adds a user-defined component to the far left of the status bar, after the status text(if any).
      Parameters:
      c - Any component
    • setProgressDefaults

      public void setProgressDefaults(boolean indeterminate, int start, int max, String progressStr)
      Sets the progress area defaults.
      Parameters:
      indeterminate - If true, indeterminate progress bar will be shown. In that case, the other arguments are ignored. If false, progress bar with bounds specified by start and max params will be shown. The progress bar is updated by setProgressValue().
      start - Specifies starting value of the progress bar and counter
      max - Specifies maximum value of the progress bar and counter
      progressStr - If not null, sets the value of progress string used in the counter.
    • setProgressValue

      public void setProgressValue(int value)
      Set scalar progress value
      Parameters:
      value - Current progress value
    • setProgressText

      public void setProgressText(String value)
      Set progress text
      Parameters:
      value - String to display in the optional progress text area
    • addCancelProgressListener

      public void addCancelProgressListener(ActionListener l)
      Adds an action listener to the cancel progress button.
      Parameters:
      l - the action listener to be added
    • removeCancelProgressListener

      public void removeCancelProgressListener(ActionListener l)
      Removes the given action listener from the cancel progress button.
      Parameters:
      l - the action listener to be removed