View Javadoc

    1   package baseCode.gui;
    2
    3   import javax.swing.Icon;
    4   import javax.swing.ImageIcon;
    5   import javax.swing.JLabel;
    6
    7   import baseCode.util.StatusViewer;
    8
    9   /***
    10   * <p>
    11   * Title:
    12   * </p>
    13   * <p>
    14   * Description:
    15   * </p>
    16   * <p>
    17   * Copyright: Copyright (c) 2003
    18   * </p>
    19   * <p>
    20   * Company:
    21   * </p>
    22   *
    23   * @author Paul Pavlidis
    24   * @version $Id: StatusJlabel.java,v 1.4 2004/07/27 03:18:58 pavlidis Exp $
    25   */
    26
    27  public class StatusJlabel implements StatusViewer {
    28     private JLabel jlabel;
    29
    30     Icon errorIcon = null;
    31
    32     public StatusJlabel( JLabel l ) {
    33        errorIcon = new ImageIcon( StatusJlabel.class
    34              .getResource( "resources/alert.gif" ) );
    35        this.jlabel = l;
    36     }
    37
    38     public void setStatus( String s ) {
    39        final String message = s;
    40        System.err.println( s );
    41        jlabel.setText( message );
    42        jlabel.setIcon( null );
    43        jlabel.repaint();
    44     }
    45
    46     /*
    47      * (non-Javadoc)
    48      *
    49      * @see baseCode.util.StatusViewer#setError(java.lang.String)
    50      */
    51     public void setError( String s ) {
    52        final String message = s;
    53        System.err.println( s );
    54        jlabel.setText( message );
    55        jlabel.setIcon( errorIcon );
    56        jlabel.repaint();
    57     }
    58
    59     /*
    60      * (non-Javadoc)
    61      *
    62      * @see baseCode.util.StatusViewer#clear()
    63      */
    64     public void clear() {
    65        jlabel.setText( "" );
    66        jlabel.setIcon( null );
    67        jlabel.repaint();
    68     }
    69  }