home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / SOURCE.BIN / StatusBar.java < prev    next >
Encoding:
Java Source  |  1997-06-19  |  3.5 KB  |  141 lines

  1. package symantec.itools.awt;
  2.  
  3.  
  4. import java.awt.Color;
  5. import java.awt.BorderLayout;
  6. import java.awt.Label;
  7. import java.awt.LayoutManager;
  8.  
  9. /** 
  10.  * Use a StatusBar to show document status and other information, like the 
  11.  * meaning of a button or other interface element in a window. Typically, 
  12.  * a status bar appears at the bottom of a window.
  13.  */
  14. public class StatusBar
  15.     extends BorderPanel
  16. {
  17.     //--------------------------------------------------
  18.     // constants
  19.     //--------------------------------------------------
  20.  
  21.  
  22.     //--------------------------------------------------
  23.     // class variables
  24.     //--------------------------------------------------
  25.  
  26.  
  27.     //--------------------------------------------------
  28.     // member variables
  29.     //--------------------------------------------------
  30.  
  31.     /**
  32.      * The text to display.
  33.      */
  34.     protected Label text;
  35.     /**
  36.      * The color of the displayed text.
  37.      */
  38.     protected Color textColor;
  39.  
  40.  
  41.     //--------------------------------------------------
  42.     // constructors
  43.     //--------------------------------------------------
  44.  
  45.     /**
  46.      * Constructs a default StatusBar.
  47.      */
  48.     public StatusBar()
  49.     {
  50.         super.setLayout(new BorderLayout());
  51.         add("Center", text = new Label());
  52.     }
  53.  
  54.  
  55.     //--------------------------------------------------
  56.     // accessor methods
  57.     //--------------------------------------------------
  58.  
  59.     /**
  60.      * Sets the text that is displayed.
  61.      * @param s the new text to display
  62.      * @see #getStatusText
  63.      */
  64.     public void setStatusText(String s)
  65.     {
  66.         text.setText(s);
  67.         invalidate();
  68.     }
  69.  
  70.     /**
  71.      * Gets the text currently displayed.
  72.      * @return the text currently displayed
  73.      * @see #setStatusText
  74.      */
  75.     public String getStatusText()
  76.     {
  77.         return text.getText();
  78.     }
  79.  
  80.     /**
  81.      * Sets the color of the text that is displayed.
  82.      * @param s the new color of the text to display
  83.      * @see #getStatusTextColor
  84.      */
  85.     public void setStatusTextColor(Color c)
  86.     {
  87.         textColor = c;
  88.         text.setForeground(c);
  89.         invalidate();
  90.     }
  91.  
  92.     /**
  93.      * Gets the text color currently displayed.
  94.      * @return the current color of displayed text
  95.      * @see #setStatusTextColor
  96.      */
  97.     public Color getStatusTextColor()
  98.     {
  99.         return textColor;
  100.     }
  101.  
  102.  
  103.     //--------------------------------------------------
  104.     // event methods
  105.     //--------------------------------------------------
  106.  
  107.  
  108.     //--------------------------------------------------
  109.     // class methods
  110.     //--------------------------------------------------
  111.  
  112.  
  113.     //--------------------------------------------------
  114.     // member methods
  115.     //--------------------------------------------------
  116.  
  117.     /**
  118.      * Takes no action.
  119.      * This is a standard Java AWT method which gets called to specify
  120.      * which layout manager should be used to layout the components in
  121.      * standard containers.
  122.      *
  123.      * Since layout managers CANNOT BE USED with this container the standard
  124.      * setLayout has been OVERRIDDEN for this container and does nothing.
  125.      *
  126.      * @param l the layout manager to use to layout this container's components
  127.      * (IGNORED)
  128.      * @see java.awt.Container#getLayout
  129.      **/
  130.     public void setLayout(LayoutManager l)
  131.     {
  132.     }
  133.  
  134.     /**
  135.      * Clears the text that gets displayed.
  136.      */
  137.     public void clear()
  138.     {
  139.         setStatusText("");
  140.     }
  141. }