home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / VCAFE.3.0A / Main.bin / Wizard.java < prev    next >
Text File  |  1998-11-11  |  18KB  |  869 lines

  1. package com.symantec.itools.frameworks.wizard;
  2.  
  3.  
  4. import java.awt.*;
  5. import java.awt.event.ActionEvent;
  6. import java.awt.event.KeyEvent;
  7. import java.awt.event.ActionListener;
  8. import java.io.InputStream;
  9. import java.io.IOException;
  10. import java.net.URL;
  11. import java.util.Enumeration;
  12. import java.util.ResourceBundle;
  13. import java.util.Vector;
  14. import java.util.Locale;
  15. import com.sun.java.swing.JComponent;
  16. import com.sun.java.swing.JButton;
  17. import com.sun.java.swing.AbstractButton;
  18. import com.sun.java.swing.JPanel;
  19. import com.sun.java.swing.UIManager;
  20. import com.sun.java.swing.JLabel;
  21. import com.sun.java.swing.border.LineBorder;
  22. import com.sun.java.swing.KeyStroke;
  23. import com.sun.java.swing.JRootPane;
  24. import com.symantec.itools.swing.icons.ImageIcon;
  25. import com.symantec.itools.util.ResourceBundleAdapter;
  26.  
  27.  
  28. /**
  29.  * @author Symantec Internet Tools Division
  30.  * @version 1.0
  31.  * @since VCafe 3.0
  32.  */
  33. public class Wizard
  34.     extends JPanel
  35. {
  36.     protected static ResourceBundle defaultResourceBundle;
  37.  
  38.     protected JPanel displayPanel;
  39.     protected JPanel pagesPanel;
  40.     protected JPanel actionPanel;
  41.     protected JPanel separatorPanel;
  42.     protected JPanel buttonsPanel;
  43.     protected JLabel imageLbl;
  44.     protected JLabel separatorLbl;
  45.     protected JButton backBtn;
  46.     protected JButton nextBtn;
  47.     protected JButton finishBtn;
  48.     protected JButton cancelBtn;
  49.     protected JButton helpBtn;
  50.     protected ImageIcon imageIcon;
  51.     protected ImageIcon separatorIcon;
  52.     protected ResourceBundleAdapter resourceBundle;
  53.     protected KeyAction keyAction;
  54.     protected boolean addEnterKeyAction;
  55.  
  56.     /**
  57.      * @since VCafe 3.0
  58.      */
  59.     protected WizardController controller;
  60.  
  61.     /**
  62.      * @since VCafe 3.0
  63.      */
  64.     protected Vector listeners;
  65.  
  66.     /**
  67.      * @since VCafe 3.0
  68.      */
  69.     protected boolean showOnAddNotify;
  70.  
  71.     /**
  72.      * @since VCafe 3.0
  73.      */
  74.     protected boolean isInitialized;
  75.  
  76.     static
  77.     {
  78.         try
  79.         {
  80.             defaultResourceBundle = ResourceBundle.getBundle("com.symantec.itools.frameworks.wizard.WizardBundle");
  81.         }
  82.         catch(Throwable ex)
  83.         {
  84.             ex.printStackTrace();
  85.         }
  86.     }
  87.  
  88.     {
  89.         listeners       = new Vector();
  90.         showOnAddNotify = true;
  91.         keyAction       = null;
  92.         addEnterKeyAction = false;
  93.     }
  94.  
  95.     public Wizard()
  96.     {
  97.         this(defaultResourceBundle);
  98.     }
  99.     
  100.     public Wizard(ResourceBundle bundle)
  101.     {
  102.         this(bundle, null);
  103.     }
  104.  
  105.     public Wizard(WizardController controller)
  106.     {
  107.         this(defaultResourceBundle, null);
  108.     }
  109.  
  110.     public Wizard(ResourceBundle bundle, WizardController c)
  111.     {
  112.         GridBagLayout gridBagLayout;
  113.  
  114.         resourceBundle = new ResourceBundleAdapter(bundle);
  115.         
  116.         if(c == null)
  117.         {
  118.             c = new WizardController(this);
  119.         }
  120.         
  121.         controller    = c;
  122.         isInitialized = false;
  123.         setLayout(new BorderLayout(0,0));
  124.         setSize(332,248);
  125.         gridBagLayout = new GridBagLayout();
  126.  
  127.         displayPanel = new JPanel();
  128.         displayPanel.setLayout(new GridBagLayout());
  129.         add("Center", displayPanel);
  130.         
  131.         imageIcon = new ImageIcon();
  132.         imageLbl  = new JLabel();
  133.         imageLbl.setDisabledIcon(imageIcon);
  134.         imageLbl.setIcon(imageIcon);        
  135.         displayPanel.add(imageLbl, new com.symantec.itools.awt.GridBagConstraintsD(0,0,1,1,-1.0,1.0,java.awt.GridBagConstraints.NORTHWEST,java.awt.GridBagConstraints.BOTH,new Insets(6,6,0,0),0,0));
  136.         imageLbl.setVisible(false);
  137.                 
  138.         pagesPanel = new JPanel();
  139.         pagesPanel.setLayout(new GridLayout(1,1,0,0));
  140.         displayPanel.add(pagesPanel, new com.symantec.itools.awt.GridBagConstraintsD(1,0,1,1,1.0,1.0,java.awt.GridBagConstraints.NORTHEAST,java.awt.GridBagConstraints.BOTH,new Insets(0,0,0,0),0,0));
  141.  
  142.         actionPanel = new JPanel();
  143.         actionPanel.setLayout(gridBagLayout);
  144.         add("South", actionPanel);
  145.  
  146.         separatorPanel = new JPanel();
  147.         separatorPanel.setLayout(new GridLayout(1,1,0,0));
  148.         actionPanel.add(separatorPanel, new com.symantec.itools.awt.GridBagConstraintsD(0,0,0,1,1.0,1.0,java.awt.GridBagConstraints.CENTER,java.awt.GridBagConstraints.BOTH,new Insets(0,6,0,0),0,0));
  149.  
  150.         try
  151.         {
  152.             separatorIcon = new ImageIcon(Wizard.class.getResourceAsStream("Separator.gif"));
  153.         }
  154.         catch(IOException ex)
  155.         {
  156.         }
  157.  
  158.         separatorLbl = new JLabel();
  159.         separatorLbl.setDisabledIcon(separatorIcon);
  160.         separatorLbl.setIcon(separatorIcon);
  161.         separatorPanel.add(separatorLbl);
  162.         separatorLbl.setVisible(false);
  163.  
  164.         buttonsPanel = new JPanel();
  165.         buttonsPanel.setLayout(new FlowLayout(FlowLayout.RIGHT,5,5));
  166.         actionPanel.add(buttonsPanel, new com.symantec.itools.awt.GridBagConstraintsD(1,1,0,1,1.0,1.0,java.awt.GridBagConstraints.CENTER,java.awt.GridBagConstraints.BOTH,new Insets(0,0,0,0),0,0));
  167.  
  168.         backBtn = new JButton();
  169.         buttonsPanel.add(backBtn);
  170.         nextBtn = new JButton();
  171.         buttonsPanel.add(nextBtn);
  172.         finishBtn = new JButton();
  173.         buttonsPanel.add(finishBtn);
  174.         cancelBtn = new JButton();
  175.         buttonsPanel.add(cancelBtn);
  176.         helpBtn = new JButton();
  177.         buttonsPanel.add(helpBtn);
  178.         setupButton(backBtn, "BACK");
  179.         setupButton(nextBtn, "NEXT");
  180.         setupButton(finishBtn, "FINISH");
  181.         setupButton(cancelBtn, "CANCEL");
  182.         setupButton(helpBtn, "HELP");
  183.  
  184.         SymAction lSymAction = new SymAction();
  185.         backBtn.addActionListener(lSymAction);
  186.         nextBtn.addActionListener(lSymAction);
  187.         finishBtn.addActionListener(lSymAction);
  188.         cancelBtn.addActionListener(lSymAction);
  189.         helpBtn.addActionListener(lSymAction);
  190.  
  191.         setDefaultButton();
  192.         
  193.         isInitialized = true;
  194.     }
  195.  
  196.     private void setupButton(JButton btn, String base)
  197.     {
  198.         String toolTipText;
  199.         
  200.         btn.setText(resourceBundle.getString(base + "_BTN_TEXT", "< Prev"));        
  201.         btn.setMnemonic(resourceBundle.getChar(base + "_BTN_MNEMONIC"));
  202.         btn.setActionCommand(resourceBundle.getString(base + "_BTN_ACTION", "prev"));
  203.         toolTipText = resourceBundle.getString(base + "_BTN_TOOLTIP", "");
  204.         
  205.         if(!(toolTipText.equals("")))
  206.         {
  207.             btn.setToolTipText(toolTipText);
  208.         }
  209.     }
  210.     
  211.     /**
  212.      * @since VCafe 3.0
  213.      */
  214.     public void setAddEnterKeyAction(boolean addEnterKeyAction)
  215.     {
  216.         this.addEnterKeyAction = addEnterKeyAction;
  217.         setDefaultButton();
  218.     }
  219.     
  220.     protected void setDefaultButton()
  221.     {
  222.         JRootPane root = getRootPane();
  223.         if (root != null)
  224.         {
  225.             if (addEnterKeyAction)
  226.             {
  227.                 if (nextBtn.isEnabled())
  228.                 {
  229.                     if (nextBtn != null)
  230.                         root.setDefaultButton(nextBtn);
  231.                 }
  232.                 else if (finishBtn.isEnabled())
  233.                 {
  234.                     if (finishBtn != null)
  235.                         root.setDefaultButton(finishBtn);
  236.                 }
  237.                 else
  238.                 {
  239.                     root.setDefaultButton(null);
  240.                 }
  241.             }
  242.             else
  243.             {
  244.                 root.setDefaultButton(null);
  245.             }
  246.         }
  247.     }
  248.     
  249.     public boolean getAddEnterKeyAction()
  250.     {
  251.         return addEnterKeyAction;
  252.     }
  253.  
  254.     /**
  255.      * @since VCafe 3.0
  256.      */
  257.  
  258.     public void addNotify()
  259.     {
  260.         super.addNotify();
  261.  
  262.         if(showOnAddNotify && controller != null)
  263.         {
  264.             controller.init();
  265.         }
  266.     }
  267.  
  268.     /**
  269.      * It has been overridden here to unhook listeners.
  270.      * @since VCafe 3.0
  271.      */
  272.     public void removeNotify()
  273.     {
  274.         super.removeNotify();
  275.         
  276.         if (keyAction != null)
  277.         {
  278.             unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0));
  279.             unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0));
  280.             keyAction = null;
  281.         }
  282.     }
  283.  
  284.     /**
  285.      * @param c TODO
  286.      * @since VCafe 3.0
  287.      */
  288.     public void setWizardController(WizardController c)
  289.     {
  290.         controller = c;
  291.     }
  292.  
  293.     /**
  294.      * @param lm TODO
  295.      * @since VCafe 3.0
  296.      */
  297.     public void setLayout(LayoutManager lm)
  298.     {
  299.         if(!(isInitialized))
  300.         {
  301.             super.setLayout(lm);
  302.         }
  303.     }
  304.  
  305.     /**
  306.      * @param comp TODO
  307.      * @since VCafe 3.0
  308.      */
  309.     public void addImpl(Component comp, Object constraints, int index)
  310.     {
  311.         if(isInitialized)
  312.         {
  313.             if(controller != null)
  314.             {
  315.                 if(comp instanceof JPanel)
  316.                 {
  317.                     controller.addPanel((JPanel)comp);
  318.                 }
  319.             }
  320.         }
  321.         else
  322.         {
  323.             super.addImpl(comp, constraints, index);
  324.         }
  325.     }
  326.  
  327.     /**
  328.      * @param panel TODO
  329.      * @since VCafe 3.0
  330.      */
  331.     protected void showPanel(JPanel panel)
  332.     {
  333.         String      panelTitle;
  334.         String      wizardTitle;
  335.         WizardEvent event;
  336.  
  337.         wizardTitle = null;
  338.         panelTitle  = null;
  339.  
  340.         if(pagesPanel.getComponentCount() > 0)
  341.         {
  342.             if(!(panel.equals(pagesPanel.getComponent(0))))
  343.             {
  344.                 pagesPanel.remove(pagesPanel.getComponent(0));
  345.                 pagesPanel.add(panel);
  346.                 pagesPanel.validate();
  347.             }
  348.         }
  349.         else
  350.         {
  351.             pagesPanel.add(panel);
  352.         }
  353.  
  354.         repaint();
  355.  
  356.         if(panel instanceof WizardPage)
  357.         {
  358.             panelTitle = ((WizardPage)panel).getPanelTitle();
  359.         }
  360.  
  361.         if(controller != null)
  362.         {
  363.             wizardTitle = controller.getWizardTitle();
  364.         }
  365.  
  366.         if(wizardTitle == null)
  367.         {
  368.             wizardTitle = "Wizard";
  369.         }
  370.  
  371.         if(panelTitle != null && panelTitle.length() > 0)
  372.         {
  373.             wizardTitle += " - " + panelTitle;
  374.         }
  375.  
  376.         event = new WizardEvent(this, WizardEvent.WIZARD_TITLE_CHANGED);
  377.         event.setNewTitle(wizardTitle);
  378.         fireWizardEvent(event);
  379.     }
  380.  
  381.     /**
  382.      * @author Symantec Internet Tools Division
  383.      * @version 1.0
  384.      * @since VCafe 3.0
  385.      */
  386.  
  387.     class SymAction
  388.         implements ActionListener
  389.     {
  390.  
  391.         /**
  392.          * @param event TODO
  393.          * @since VCafe 3.0
  394.          */
  395.         public void actionPerformed(ActionEvent event)
  396.         {
  397.             Object object;
  398.  
  399.             object = event.getSource();
  400.  
  401.             if(object == backBtn)
  402.             {
  403.                 backBtnActionPerformed(event);
  404.             }
  405.             else if(object == nextBtn)
  406.             {
  407.                 nextBtnActionPerformed(event);
  408.             }
  409.             else if(object == finishBtn)
  410.             {
  411.                 finishBtnActionPerformed(event);
  412.             }
  413.             else if(object == cancelBtn)
  414.             {
  415.                 cancelBtnActionPerformed(event);
  416.             }
  417.             else if(object == helpBtn)
  418.             {
  419.                 helpBtnActionPerformed(event);
  420.             }
  421.         }
  422.     }
  423.  
  424.     /**
  425.      * KeyAction
  426.      * @since VCafe 3.0
  427.      */
  428.     public class KeyAction implements java.awt.event.ActionListener
  429.     {
  430.         /**
  431.          * Handles Action Events associated with registered keyboard actions.
  432.          */
  433.         public void actionPerformed(java.awt.event.ActionEvent event)
  434.         {
  435.             String command = event.getActionCommand();
  436.             
  437.             if (command.equals("enter pressed")) {
  438.                 if (isNextEnabled()) {
  439.                     nextBtnActionPerformed(null);
  440.                 } else if (isFinishEnabled()) {
  441.                     finishBtnActionPerformed(null);
  442.                 }
  443.             }
  444.         }
  445.     }
  446.  
  447.     /**
  448.      * @param event TODO
  449.      * @since VCafe 3.0
  450.      */
  451.  
  452.     void backBtnActionPerformed(ActionEvent event)
  453.     {
  454.         if(controller != null)
  455.         {
  456.             controller.backPanel();
  457.             setDefaultButton();
  458.         }
  459.     }
  460.  
  461.     /**
  462.      * @param event TODO
  463.      * @since VCafe 3.0
  464.      */
  465.  
  466.     void nextBtnActionPerformed(ActionEvent event)
  467.     {
  468.         if(controller != null)
  469.         {
  470.             controller.nextPanel();
  471.             setDefaultButton();
  472.         }
  473.     }
  474.  
  475.     /**
  476.      * @param event TODO
  477.      * @since VCafe 3.0
  478.      */
  479.  
  480.     void finishBtnActionPerformed(ActionEvent event)
  481.     {
  482.         finish();
  483.     }
  484.  
  485.     /**
  486.      * @param event TODO
  487.      * @since VCafe 3.0
  488.      */
  489.  
  490.     void cancelBtnActionPerformed(ActionEvent event)
  491.     {
  492.         cancel();
  493.     }
  494.  
  495.     /**
  496.      * @param event TODO
  497.      * @since VCafe 3.0
  498.      */
  499.  
  500.     void helpBtnActionPerformed(ActionEvent event)
  501.     {
  502.         if(controller != null)
  503.         {
  504.             controller.help();
  505.         }
  506.     }
  507.  
  508.     /**
  509.      * @param f TODO
  510.      * @since VCafe 3.0
  511.      */
  512.  
  513.     public void setBackEnabled(boolean f)
  514.     {
  515.         enableButton(backBtn, f);
  516.     }
  517.  
  518.     /**
  519.      * @param f TODO
  520.      * @since VCafe 3.0
  521.      */
  522.  
  523.     public void setNextEnabled(boolean f)
  524.     {
  525.         enableButton(nextBtn, f);
  526.         setDefaultButton();
  527.     }
  528.  
  529.     /**
  530.      * @param f TODO
  531.      * @since VCafe 3.0
  532.      */
  533.  
  534.     public void setFinishEnabled(boolean f)
  535.     {
  536.         enableButton(finishBtn, f);
  537.         setDefaultButton();
  538.     }
  539.  
  540.     /**
  541.      * @param f TODO
  542.      * @since VCafe 3.0
  543.      */
  544.  
  545.     public void setCancelEnabled(boolean f)
  546.     {
  547.         enableButton(cancelBtn, f);
  548.     }
  549.  
  550.     /**
  551.      * @param f TODO
  552.      * @since VCafe 3.0
  553.      */
  554.  
  555.     public void setHelpEnabled(boolean f)
  556.     {
  557.         enableButton(helpBtn, f);
  558.     }
  559.  
  560.     /**
  561.      * @param b TODO
  562.      * @param f TODO
  563.      * @since VCafe 3.0
  564.      */
  565.  
  566.     private void enableButton(AbstractButton b, boolean f)
  567.     {
  568.         b.setEnabled(f);
  569.         b.setFocusPainted(f);
  570.     }
  571.  
  572.     /**
  573.      * @since VCafe 3.0
  574.      */
  575.  
  576.     public boolean isBackEnabled()
  577.     {
  578.         return (backBtn.isEnabled());
  579.     }
  580.  
  581.     /**
  582.      * @since VCafe 3.0
  583.      */
  584.  
  585.     public boolean isNextEnabled()
  586.     {
  587.         return (nextBtn.isEnabled());
  588.     }
  589.  
  590.     /**
  591.      * @since VCafe 3.0
  592.      */
  593.  
  594.     public boolean isFinishEnabled()
  595.     {
  596.         return (finishBtn.isEnabled());
  597.     }
  598.  
  599.     /**
  600.      * @since VCafe 3.0
  601.      */
  602.  
  603.     public boolean isCancelEnabled()
  604.     {
  605.         return (cancelBtn.isEnabled());
  606.     }
  607.  
  608.     /**
  609.      * @since VCafe 3.0
  610.      */
  611.  
  612.     public boolean isHelpEnabled()
  613.     {
  614.         return (helpBtn.isEnabled());
  615.     }
  616.  
  617.     /**
  618.      * @since VCafe 3.0
  619.      */
  620.  
  621.     public void setBackFocus()
  622.     {
  623.         backBtn.requestFocus();
  624.     }
  625.  
  626.     /**
  627.      * @since VCafe 3.0
  628.      */
  629.  
  630.     public void setNextFocus()
  631.     {
  632.         nextBtn.requestFocus();
  633.     }
  634.  
  635.     /**
  636.      * @since VCafe 3.0
  637.      */
  638.  
  639.     public void setFinishFocus()
  640.     {
  641.         finishBtn.requestFocus();
  642.     }
  643.  
  644.     /**
  645.      * @since VCafe 3.0
  646.      */
  647.  
  648.     public void setCancelFocus()
  649.     {
  650.         cancelBtn.requestFocus();
  651.     }
  652.  
  653.     /**
  654.      * @since VCafe 3.0
  655.      */
  656.  
  657.     public void setHelpFocus()
  658.     {
  659.         helpBtn.requestFocus();
  660.     }
  661.  
  662.     /**
  663.      * @since VCafe 3.0
  664.      */
  665.  
  666.     public void finish()
  667.     {
  668.         if(controller != null)
  669.         {
  670.             controller.finish();
  671.         }
  672.  
  673.         fireWizardEvent(new WizardEvent(this, WizardEvent.WIZARD_FINISH_REQUESTED));
  674.     }
  675.  
  676.     /**
  677.      * @since VCafe 3.0
  678.      */
  679.  
  680.     public void finishSuccessful()
  681.     {
  682.         fireWizardEvent(new WizardEvent(this, WizardEvent.WIZARD_FINISHED_SUCCESSFULLY));
  683.     }
  684.  
  685.     /**
  686.      * @since VCafe 3.0
  687.      */
  688.  
  689.     public void cancel()
  690.     {
  691.         if(controller != null)
  692.         {
  693.             controller.cancel();
  694.         }
  695.  
  696.         fireWizardEvent(new WizardEvent(this, WizardEvent.WIZARD_CANCEL));
  697.     }
  698.  
  699.     /**
  700.      * @param listener TODO
  701.      * @since VCafe 3.0
  702.      */
  703.  
  704.     public void addWizardListener(WizardListener listener)
  705.     {
  706.         if(!(listeners.contains(listener)))
  707.         {
  708.             listeners.addElement(listener);
  709.         }
  710.     }
  711.  
  712.     /**
  713.      * @param listener TODO
  714.      * @since VCafe 3.0
  715.      */
  716.  
  717.     public void removeWizardListener(WizardListener listener)
  718.     {
  719.         if(listeners.contains(listener))
  720.         {
  721.             listeners.removeElement(listener);
  722.         }
  723.     }
  724.  
  725.     /**
  726.      * @param event TODO
  727.      * @since VCafe 3.0
  728.      */
  729.  
  730.     protected void fireWizardEvent(WizardEvent event)
  731.     {
  732.         Vector tempListeners;
  733.  
  734.         synchronized(listeners)
  735.         {
  736.             tempListeners = (Vector)listeners.clone();
  737.         }
  738.  
  739.         switch(event.getID())
  740.         {
  741.             case WizardEvent.WIZARD_FINISH_REQUESTED:
  742.             {
  743.                 for(Enumeration e = listeners.elements(); e.hasMoreElements();)
  744.                 {
  745.                     ((WizardListener)e.nextElement()).wizardFinishRequested(event);
  746.                 }
  747.  
  748.                 break;
  749.             }
  750.             case WizardEvent.WIZARD_FINISHED_SUCCESSFULLY:
  751.             {
  752.                 for(Enumeration e = listeners.elements(); e.hasMoreElements();)
  753.                 {
  754.                     ((WizardListener)e.nextElement()).wizardFinishedSuccessfully(event);
  755.                 }
  756.  
  757.                 break;
  758.             }
  759.             case WizardEvent.WIZARD_CANCEL:
  760.             {
  761.                 for(Enumeration e = listeners.elements(); e.hasMoreElements();)
  762.                 {
  763.                     ((WizardListener)e.nextElement()).wizardCanceled(event);
  764.                 }
  765.  
  766.                 break;
  767.             }
  768.             case WizardEvent.WIZARD_TITLE_CHANGED:
  769.             {
  770.                 for(Enumeration e = listeners.elements(); e.hasMoreElements();)
  771.                 {
  772.                     ((WizardListener)e.nextElement()).wizardTitleChanged(event);
  773.                 }
  774.  
  775.                 break;
  776.             }
  777.         }
  778.     }
  779.  
  780.     /**
  781.      * @since VCafe 3.0
  782.      */
  783.     public Frame getParentFrame()
  784.     {
  785.         Container parent;
  786.         Frame     frame;
  787.  
  788.         parent = getParent();
  789.         frame  = null;
  790.  
  791.         while(parent != null)
  792.         {
  793.             if(parent == null)
  794.             {
  795.                 break;
  796.             }
  797.             else if(parent instanceof Frame)
  798.             {
  799.                 frame = (Frame) parent;
  800.             }
  801.  
  802.             parent = parent.getParent();
  803.         }
  804.  
  805.         return frame;
  806.     }
  807.  
  808.     /**
  809.      * @param visible TODO
  810.      * @since VCafe 3.0
  811.      */
  812.     public void setSeparatorVisible(boolean visible)
  813.     {
  814.         separatorLbl.setVisible(visible);
  815.     }
  816.  
  817.     /**
  818.      * @since VCafe 3.0
  819.      */
  820.     public boolean isSeparatorVisible()
  821.     {
  822.         return separatorLbl.isVisible();
  823.     }
  824.  
  825.     public Dimension getMinimumSize()
  826.     {
  827.         return (getPreferredSize());
  828.     }
  829.  
  830.     public Dimension getPreferredSize()
  831.     {
  832.         return (new Dimension(480, 345));
  833.     }
  834.     
  835.     public void setImage(Image image)
  836.     {
  837.         setImage(new ImageIcon(image));
  838.     }
  839.     
  840.     public void setImage(URL url)
  841.     {
  842.         setImage(new ImageIcon(url));
  843.     }
  844.     
  845.     public void setImage(InputStream stream)
  846.         throws IOException
  847.     {
  848.           setImage(new ImageIcon(stream));
  849.     }
  850.     
  851.     public void setImage(ImageIcon icon)
  852.     {
  853.         imageIcon = icon;
  854.         
  855.         if(icon != null)
  856.         {
  857.             imageLbl.setDisabledIcon(imageIcon);
  858.             imageLbl.setIcon(imageIcon);
  859.             imageLbl.setVisible(true);
  860.             displayPanel.validate();
  861.         }
  862.         else
  863.         {
  864.             imageLbl.setVisible(false);
  865.         }
  866.         
  867.         repaint();
  868.     }
  869. }