/[classpath]/classpath/javax/swing/JLabel.java
ViewVC logotype

Diff of /classpath/javax/swing/JLabel.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by rveldema, Mon Mar 11 15:48:06 2002 UTC revision 1.2 by rveldema, Tue Mar 12 11:36:22 2002 UTC
# Line 17  public class JLabel extends JComponent i Line 17  public class JLabel extends JComponent i
17      int vert_align;      int vert_align;
18      int vert_text_pos;      int vert_text_pos;
19    
20      JLabel()      public JLabel()
21      {      {
22          this("", null, 0);          this("", null, 0);
23      }      }
24    
25      JLabel(Icon image)      public JLabel(Icon image)
26      {      {
27          this("", image, 0);          this("", image, 0);
28      }      }
29    
30      JLabel(Icon image, int horizontalAlignment)      public JLabel(Icon image, int horizontalAlignment)
31      {      {
32          this("", image, horizontalAlignment);          this("", image, horizontalAlignment);
33      }      }
34    
35      JLabel(String text)      public JLabel(String text)
36      {      {
37          this(text, null, 0);          this(text, null, 0);
38      }      }
39    
40      JLabel(String text, int horizontalAlignment)      public JLabel(String text, int horizontalAlignment)
41      {      {
42          this(text, null, horizontalAlignment);          this(text, null, horizontalAlignment);
43      }      }
44    
45      JLabel(String text, Icon icon, int horizontalAlignment)      public JLabel(String text, Icon icon, int horizontalAlignment)
46      {      {
47          // do the work.....          // do the work.....
48          this.text = text;          this.text = text;
# Line 63  public class JLabel extends JComponent i Line 63  public class JLabel extends JComponent i
63          //      Verify that key is a legal value for the verticalAlignment or verticalTextPosition properties.            //      Verify that key is a legal value for the verticalAlignment or verticalTextPosition properties.  
64          return 0;          return 0;
65      }      }
66      AccessibleContext getAccessibleContext()      public AccessibleContext getAccessibleContext()
67      {      {
68          //          Get the AccessibleContext of this object          //          Get the AccessibleContext of this object
69          return null;          return null;
70      }      }
71      Icon getDisabledIcon()      public Icon getDisabledIcon()
72      {      {
73          //          Returns the value of the disabledIcon property if it's been set, If it hasn't been set and the value of the icon property is an ImageIcon, we compute a "grayed out" version of the icon and update the disabledIcon property with that.            //          Returns the value of the disabledIcon property if it's been set, If it hasn't been set and the value of the icon property is an ImageIcon, we compute a "grayed out" version of the icon and update the disabledIcon property with that.  
74          return null;          return null;
75      }      }
76      int getDisplayedMnemonic()      public int getDisplayedMnemonic()
77      {      {
78          //          Return the keycode that indicates a mnemonic key.            //          Return the keycode that indicates a mnemonic key.  
79          return 0;          return 0;
80      }      }
81      int getHorizontalAlignment()      public int getHorizontalAlignment()
82      {      {
83          //          Returns the alignment of the label's contents along the X axis.            //          Returns the alignment of the label's contents along the X axis.  
84          return hor_align;          return hor_align;
85      }      }
86      int getHorizontalTextPosition()      public int getHorizontalTextPosition()
87      {      {
88          //          Returns the horizontal position of the label's text, relative to its image.              //          Returns the horizontal position of the label's text, relative to its image.    
89          return hor_text_pos;          return hor_text_pos;
90      }      }
91    
92      Icon getIcon()      public Icon getIcon()
93      {   return icon;    }      {   return icon;    }
94    
95      int getIconTextGap()      public int getIconTextGap()
96      {      {
97          //          Returns the amount of space between the text and the icon displayed in this label.            //          Returns the amount of space between the text and the icon displayed in this label.  
98          return 0;          return 0;
99      }      }
100      Component getLabelFor()      public Component getLabelFor()
101      {      {
102          //          Get the component this is labelling.            //          Get the component this is labelling.  
103          return null;          return null;
104      }      }
105      String getText()      public String getText()
106      {   return text;    }      {   return text;    }
107    
108      String getUIClassID()      public String getUIClassID()
109      {   return "JLabel";    }      {   return "JLabel";    }
110    
111      int getVerticalAlignment()      public int getVerticalAlignment()
112      {      {
113          //          Returns the alignment of the label's contents along the Y axis.          //          Returns the alignment of the label's contents along the Y axis.
114          return vert_align;          return vert_align;
115      }      }
116      int getVerticalTextPosition()      public int getVerticalTextPosition()
117      {      {
118          //          Returns the vertical position of the label's text, relative to its image.          //          Returns the vertical position of the label's text, relative to its image.
119          return vert_text_pos;          return vert_text_pos;
# Line 129  public class JLabel extends JComponent i Line 129  public class JLabel extends JComponent i
129          //          Returns a string representation of this JLabel.            //          Returns a string representation of this JLabel.  
130          return "JLabel";          return "JLabel";
131      }      }
132      void setDisabledIcon(Icon disabledIcon)      public void setDisabledIcon(Icon disabledIcon)
133      {      {
134          //          Set the icon to be displayed if this JLabel is "disabled" (JLabel.setEnabled(false)).            //          Set the icon to be displayed if this JLabel is "disabled" (JLabel.setEnabled(false)).  
135      }      }
136      void setDisplayedMnemonic(char aChar)      public void setDisplayedMnemonic(char aChar)
137      {      {
138          //          Specifies the displayedMnemonic as a char value.            //          Specifies the displayedMnemonic as a char value.  
139      }      }
140      void setDisplayedMnemonic(int key)      public void setDisplayedMnemonic(int key)
141      {      {
142          //          Specify a keycode that indicates a mnemonic key.            //          Specify a keycode that indicates a mnemonic key.  
143      }      }
144      void setHorizontalAlignment(int alignment)      public void setHorizontalAlignment(int alignment)
145      {      {
146          //          Sets the alignment of the label's contents along the X axis.            //          Sets the alignment of the label's contents along the X axis.  
147          hor_align = alignment;          hor_align = alignment;
148      }      }
149      void setHorizontalTextPosition(int textPosition)      public void setHorizontalTextPosition(int textPosition)
150      {      {
151          //          Sets the horizontal position of the label's text, relative to its image.            //          Sets the horizontal position of the label's text, relative to its image.  
152          hor_text_pos = textPosition;          hor_text_pos = textPosition;
153      }      }
154      void setIcon(Icon icon)      public void setIcon(Icon icon)
155      {      {
156          this.icon = icon;          this.icon = icon;
157          if (icon != null)          if (icon != null)
# Line 162  public class JLabel extends JComponent i Line 162  public class JLabel extends JComponent i
162          repaint();          repaint();
163      }      }
164    
165      void setIconTextGap(int iconTextGap)      public void setIconTextGap(int iconTextGap)
166      {      {
167          gap = iconTextGap;          gap = iconTextGap;
168      }      }
169        
170      void setLabelFor(Component c)      public void setLabelFor(Component c)
171      {      {
172          //          Set the component this is labelling.            //          Set the component this is labelling.  
173      }      }
174      void setText(String text)      public void setText(String text)
175      {      {
176          this.text = text;          this.text = text;
177          revalidate();          revalidate();
178          repaint();          repaint();
179      }      }
180        
181      void setVerticalAlignment(int alignment)      public void setVerticalAlignment(int alignment)
182      {      {
183          //          Sets the alignment of the label's contents along the Y axis.            //          Sets the alignment of the label's contents along the Y axis.  
184          vert_align = alignment;          vert_align = alignment;
185      }      }
186      void setVerticalTextPosition(int textPosition)      public void setVerticalTextPosition(int textPosition)
187      {      {
188          //          Sets the vertical position of the label's text, relative to its image.            //          Sets the vertical position of the label's text, relative to its image.  
189          vert_text_pos = textPosition;          vert_text_pos = textPosition;
190      }      }
191      void updateUI()      public void updateUI()
192      {        {  
193          LabelUI b = (LabelUI)UIManager.getUI(this);          LabelUI b = (LabelUI)UIManager.getUI(this);
194          setUI(b);          setUI(b);

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26