public class BasicLabelUI extends LabelUI implements PropertyChangeListener
| Modifier and Type | Field and Description |
|---|---|
protected static BasicLabelUI |
labelUI
The labelUI that is shared by all labels.
|
| Constructor and Description |
|---|
BasicLabelUI()
Creates a new BasicLabelUI object.
|
| Modifier and Type | Method and Description |
|---|---|
static ComponentUI |
createUI(JComponent c)
Creates and returns a UI for the label.
|
Dimension |
getMaximumSize(JComponent c)
This method returns the maximum size of the
JComponent given. |
Dimension |
getMinimumSize(JComponent c)
This method returns the minimum size of the
JComponent given. |
Dimension |
getPreferredSize(JComponent c)
Returns the preferred size of this component as calculated by the
layoutCL(JLabel, FontMetrics, String, Icon, Rectangle, Rectangle,
Rectangle) method. |
protected void |
installComponents(JLabel c)
This method installs the components for this
JLabel. |
protected void |
installDefaults(JLabel c)
This method installs the defaults that are defined in the Basic look and
feel for this
JLabel. |
protected void |
installKeyboardActions(JLabel l)
Installs the keyboard actions for the given
JLabel. |
protected void |
installListeners(JLabel c)
This method installs the listeners for the given
JLabel. |
void |
installUI(JComponent c)
This method installs the UI for the given
JComponent. |
protected String |
layoutCL(JLabel label,
FontMetrics fontMetrics,
String text,
Icon icon,
Rectangle viewR,
Rectangle iconR,
Rectangle textR)
This method is simply calls SwingUtilities's layoutCompoundLabel.
|
void |
paint(Graphics g,
JComponent c)
The method that paints the label according to its current state.
|
protected void |
paintDisabledText(JLabel l,
Graphics g,
String s,
int textX,
int textY)
Paints the text if the label is disabled.
|
protected void |
paintEnabledText(JLabel l,
Graphics g,
String s,
int textX,
int textY)
Paints the text if the label is enabled.
|
void |
propertyChange(PropertyChangeEvent e)
This method is called whenever any JLabel's that use this UI has one of
their properties change.
|
protected void |
uninstallComponents(JLabel c)
This method uninstalls the components for this
JLabel. |
protected void |
uninstallDefaults(JLabel c)
This method uninstalls the defaults that are defined in the Basic look
and feel for this
JLabel. |
protected void |
uninstallKeyboardActions(JLabel l)
This method uninstalls the keyboard actions for the given
JLabel. |
protected void |
uninstallListeners(JLabel c)
This method uninstalls the listeners for the given
JLabel. |
void |
uninstallUI(JComponent c)
This method uninstalls the UI for the given
JComponent. |
contains, getAccessibleChild, getAccessibleChildrenCount, updateprotected static BasicLabelUI labelUI
public BasicLabelUI()
public static ComponentUI createUI(JComponent c)
c - The JComponent that a UI is being created for.public Dimension getPreferredSize(JComponent c)
layoutCL(JLabel, FontMetrics, String, Icon, Rectangle, Rectangle,
Rectangle) method.getPreferredSize in class ComponentUIc - This JComponent to get a preferred size for.public Dimension getMinimumSize(JComponent c)
JComponent given. If
this method returns null, then it is up to the Layout Manager to give
this component a minimum size.getMinimumSize in class ComponentUIc - The JComponent to get a minimum size for.public Dimension getMaximumSize(JComponent c)
JComponent given. If
this method returns null, then it is up to the Layout Manager to give
this component a maximum size.getMaximumSize in class ComponentUIc - The JComponent to get a maximum size for.public void paint(Graphics g, JComponent c)
paint in class ComponentUIg - The Graphics object to paint with.c - The JComponent to paint.protected String layoutCL(JLabel label, FontMetrics fontMetrics, String text, Icon icon, Rectangle viewR, Rectangle iconR, Rectangle textR)
label - The label to lay out.fontMetrics - The FontMetrics for the font used.text - The text to paint.icon - The icon to draw.viewR - The entire viewable rectangle.iconR - The icon bounds rectangle.textR - The text bounds rectangle.protected void paintDisabledText(JLabel l, Graphics g, String s, int textX, int textY)
protected void paintEnabledText(JLabel l, Graphics g, String s, int textX, int textY)
public void installUI(JComponent c)
JComponent. This
method will install the component, defaults, listeners, and keyboard
actions.installUI in class ComponentUIc - The JComponent that this UI is being installed on.ComponentUI.uninstallUI(javax.swing.JComponent),
JComponent.setUI(javax.swing.plaf.ComponentUI),
JComponent.updateUI()public void uninstallUI(JComponent c)
JComponent. This
method will uninstall the component, defaults, listeners, and keyboard
actions.uninstallUI in class ComponentUIc - The JComponent that this UI is being installed on.ComponentUI.installUI(javax.swing.JComponent),
JComponent.setUI(javax.swing.plaf.ComponentUI),
JComponent.updateUI()protected void installComponents(JLabel c)
JLabel.c - The JLabel to install components for.protected void uninstallComponents(JLabel c)
JLabel.c - The JLabel to uninstall components for.protected void installDefaults(JLabel c)
JLabel.c - The JLabel to install defaults for.protected void uninstallDefaults(JLabel c)
JLabel.c - The JLabel to uninstall defaults for.protected void installKeyboardActions(JLabel l)
JLabel.l - The JLabel to install keyboard actions for.protected void uninstallKeyboardActions(JLabel l)
JLabel.l - The JLabel to uninstall keyboard actions for.protected void installListeners(JLabel c)
JLabel. The UI
delegate only listens to the label.c - The JLabel to install listeners for.protected void uninstallListeners(JLabel c)
JLabel. The UI
delegate only listens to the label.c - The JLabel to uninstall listeners for.public void propertyChange(PropertyChangeEvent e)
propertyChange in interface PropertyChangeListenere - The PropertyChangeEvent that describes the change.