Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: javatools/swing/PresentationPanel.java


1   /*
2    * Presentation.java
3    *
4    * Created on 7 gennaio 2002, 18.43
5       Javatools (modified version) - Some useful general classes.
6       Copyright (C) 2002-2003  Chris Bitmead (original) Antonio Petrelli (modified)
7   
8       This program is free software; you can redistribute it and/or modify
9       it under the terms of the GNU General Public License as published by
10      the Free Software Foundation; either version 2 of the License, or
11      (at your option) any later version.
12  
13      This program is distributed in the hope that it will be useful,
14      but WITHOUT ANY WARRANTY; without even the implied warranty of
15      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16      GNU General Public License for more details.
17  
18      You should have received a copy of the GNU General Public License
19      along with this program; if not, write to the Free Software
20      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  
22      Contact me at: brenmcguire@users.sourceforge.net
23   */
24  
25  package javatools.swing;
26  
27  import java.lang.*;
28  import java.io.*;
29  
30  /**
31   * It is a class representing a panel used only to display text into a label.
32   * @author Antonio Petrelli
33   * @version 0.0.1
34   */
35  public class PresentationPanel extends InputPanel {
36  
37      /** Creates new form Presentation */
38      public PresentationPanel() {
39          initComponents();
40      }
41  
42      /** This method is called from within the constructor to
43       * initialize the form.
44       * WARNING: Do NOT modify this code. The content of this method is
45       * always regenerated by the Form Editor.
46       */
47      private void initComponents() {//GEN-BEGIN:initComponents
48          lblDescription = new javax.swing.JLabel();
49  
50          setLayout(new java.awt.BorderLayout());
51  
52          add(lblDescription, java.awt.BorderLayout.CENTER);
53  
54      }//GEN-END:initComponents
55  
56      /** Returns the number of managed values.
57       * @return Returns 1.
58       */    
59      public int getNumValues() {
60          return 1;
61      }    
62  
63      /** Returns the value whose position is specified.
64       * @param numValue <CODE>0</CODE>: The text to display.
65       * @throws WizardException If <CODE>numValue is not valid</CODE>
66       * @return The value.
67       */    
68      public String getValue(int numValue) throws WizardException {
69          if (numValue == 0)
70              return lblDescription.getText();
71          else
72              throw new WizardException();
73      }    
74  
75      /** Sets the value whose position is specified.
76       * @param numValue <CODE>0</CODE>: The text to display.
77       * @param value The value.
78       * @throws WizardException If <CODE>numValue</CODE> is not valid.
79       */    
80      public void setValue(int numValue, String value) throws WizardException {
81          if (numValue == 0)
82              lblDescription.setText(value);
83          else
84              throw new WizardException();
85      }
86      
87      /** Sets the value whose name is specified.
88       * @param name <CODE>"PresentationText"</CODE>: the text to display.
89       * @param value The value.
90       */    
91      public void setValue(String name, String value) {
92          if (name.equals("PresentationText"))
93              lblDescription.setText(value);
94      }
95      
96      /** Returns the value whose name is specified.
97       * @param name <CODE>"PresentationText"</CODE>: The text to display.
98       * @return The value.
99       */    
100     public String getValue(String name) {
101         if (name.equals("PresentationText"))
102             return lblDescription.getText();
103         return "";
104     }
105     
106     /** Returns the position of a value whose name is specified.
107      * @param name The name of the value.
108      * @return The position of the value.
109      */    
110     public int getValuePos(String name) {
111         if (name.equals("PresentationText"))
112             return 0;
113         return -1;
114     }
115     
116     /** Returns the name of a value whose position is specified.
117      * @param numValue The position of the value.
118      * @throws WizardException If <CODE>numValue</CODE> is not valid.
119      * @return The name of the value.
120      */    
121     public String getValueName(int numValue) throws WizardException{
122         if (numValue == 0)
123             return "PresentationText";
124         else
125             throw new WizardException("Value number not valid!");
126     }
127     
128     // Variables declaration - do not modify//GEN-BEGIN:variables
129     private javax.swing.JLabel lblDescription;
130     // End of variables declaration//GEN-END:variables
131 
132 }