View Javadoc

    1   package baseCode.gui;
    2
    3   import java.awt.BorderLayout;
    4   import java.awt.Color;
    5
    6   import javax.swing.JLabel;
    7   import javax.swing.JPanel;
    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 not attributable
    24   * @version $Id: WizardStep.java,v 1.11 2004/07/27 03:18:58 pavlidis Exp $
    25   */
    26
    27  public abstract class WizardStep extends JPanel {
    28
    29     Wizard owner;
    30
    31     /***
    32      * @param wiz
    33      */
    34     public WizardStep( Wizard wiz ) {
    35        super();
    36        owner = wiz;
    37        try {
    38           BorderLayout layout = new BorderLayout();
    39           this.setLayout( layout );
    40           jbInit();
    41        } catch ( Exception e ) {
    42           e.printStackTrace();
    43        }
    44     }
    45
    46     //Component initialization
    47     protected abstract void jbInit() throws Exception;
    48
    49     abstract public boolean isReady();
    50
    51     protected void addMain( JPanel panel ) {
    52        this.add( panel, BorderLayout.CENTER );
    53     }
    54
    55     /***
    56      * @param text
    57      * @todo why the spaces for layout?
    58      */
    59     protected void addHelp( String text ) {
    60        JLabel label = new JLabel( text );
    61        JLabel jLabel1 = new JLabel( "      " );
    62        JLabel jLabel2 = new JLabel( " " );
    63        JLabel jLabel3 = new JLabel( " " );
    64        JLabel jLabel4 = new JLabel( "      " );
    65        BorderLayout borderLayout1 = new BorderLayout();
    66        JPanel labelPanel = new JPanel();
    67        labelPanel.setBackground( Color.WHITE );
    68        labelPanel.setLayout( borderLayout1 );
    69        labelPanel.add( label, BorderLayout.CENTER );
    70        labelPanel.add( jLabel1, BorderLayout.WEST );
    71        labelPanel.add( jLabel2, BorderLayout.NORTH );
    72        labelPanel.add( jLabel3, BorderLayout.SOUTH );
    73        labelPanel.add( jLabel4, BorderLayout.EAST );
    74        this.add( labelPanel, BorderLayout.NORTH );
    75     }
    76
    77     /***
    78      * Print a message to the status bar.
    79      *
    80      * @param a
    81      */
    82     public void showStatus( String a ) {
    83        owner.showStatus( a );
    84     }
    85
    86     /***
    87      * Print an error message to the status bar.
    88      *
    89      * @param a
    90      */
    91     public void showError( String a ) {
    92        owner.showError( a );
    93     }
    94
    95  }