|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.plaf.ComponentUI
javax.swing.plaf.LayerUI<V>
V - one of the super types of JLayer's view componentpublic class LayerUI<V extends Component>
Disabled: no SafeJ information.
The base class for all JLayer's UI delegates.
paint(java.awt.Graphics, javax.swing.JComponent) method performes the
painting of the JLayer
and eventDispatched(AWTEvent, JLayer) method is notified
about any AWTEvents which have been generated by a JLayer
or any of its subcomponents.
The LayerUI differs from the UI delegates of the other components,
because it is LookAndFeel independent and is not updated by default when
the system LookAndFeel is changed.
The subclasses of LayerUI can either be stateless and shareable
by multiple JLayers or not shareable.
JLayer.setUI(LayerUI),
JLayer.setView(Component),
JLayer.getView()| Constructor Summary | |
|---|---|
LayerUI()
|
|
| Method Summary | |
|---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list. |
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list for a specific property. |
void |
applyPropertyChange(PropertyChangeEvent evt,
JLayer<? extends V> l)
Notifies the LayerUI when any of its property are changed
and enables updating every JLayer
this LayerUI instance is set to. |
protected void |
configureGraphics(Graphics2D g2,
JLayer<? extends V> l)
This method is called by the paint(java.awt.Graphics, javax.swing.JComponent) method prior to
paintLayer(java.awt.Graphics2D, javax.swing.JLayer extends V>) to configure the Graphics2D object. |
void |
eventDispatched(AWTEvent e,
JLayer<? extends V> l)
Dispatches AWTEvents for JLayer
and all its subcomponents to this LayerUI instance. |
protected void |
firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
Support for reporting bound property changes for Object properties. |
int |
getBaseline(JComponent c,
int width,
int height)
If the JLayer's view component is not null,
this calls the view's getBaseline() method. |
Component.BaselineResizeBehavior |
getBaselineResizeBehavior(JComponent c)
If the JLayer's view component is not null,
this calls the view's getBaselineResizeBehavior() method. |
Dimension |
getPreferredScrollableViewportSize(JLayer<? extends V> l)
Returns the preferred size of the viewport for a view component. |
PropertyChangeListener[] |
getPropertyChangeListeners()
Returns an array of all the property change listeners registered on this component. |
PropertyChangeListener[] |
getPropertyChangeListeners(String propertyName)
Returns an array of all the listeners which have been associated with the named property. |
int |
getScrollableBlockIncrement(JLayer<? extends V> l,
Rectangle visibleRect,
int orientation,
int direction)
Returns a scroll increment, which is required for components that display logical rows or columns in order to completely expose one block of rows or columns, depending on the value of orientation. |
boolean |
getScrollableTracksViewportHeight(JLayer<? extends V> l)
Returns false to indicate that the height of the viewport does not
determine the height of the layer, unless the preferred height
of the layer is smaller than the height of the viewport. |
boolean |
getScrollableTracksViewportWidth(JLayer<? extends V> l)
Returns false to indicate that the width of the viewport does not
determine the width of the layer, unless the preferred width
of the layer is smaller than the width of the viewport. |
int |
getScrollableUnitIncrement(JLayer<? extends V> l,
Rectangle visibleRect,
int orientation,
int direction)
Returns a scroll increment, which is required for components that display logical rows or columns in order to completely expose one new row or column, depending on the value of orientation. |
void |
installUI(JComponent c)
Configures the JLayer this LayerUI is set to. |
void |
paint(Graphics g,
JComponent c)
Paints the specified component. |
protected void |
paintLayer(Graphics2D g2,
JLayer<? extends V> l)
Called by the paint(java.awt.Graphics, javax.swing.JComponent) method,
subclasses should override this method
to perform any custom painting operations. |
protected void |
processComponentEvent(ComponentEvent e,
JLayer<? extends V> l)
Processes component events occurring on the JLayer
or any of its subcomponents. |
protected void |
processFocusEvent(FocusEvent e,
JLayer<? extends V> l)
Processes focus events occurring on the JLayer
or any of its subcomponents. |
protected void |
processHierarchyBoundsEvent(HierarchyEvent e,
JLayer<? extends V> l)
Processes hierarchy bounds event occurring on the JLayer
or any of its subcomponents. |
protected void |
processHierarchyEvent(HierarchyEvent e,
JLayer<? extends V> l)
Processes hierarchy event occurring on the JLayer
or any of its subcomponents. |
protected void |
processInputMethodEvent(InputMethodEvent e,
JLayer<? extends V> l)
Processes input event occurring on the JLayer
or any of its subcomponents. |
protected void |
processKeyEvent(KeyEvent e,
JLayer<? extends V> l)
Processes key events occurring on the JLayer
or any of its subcomponents. |
protected void |
processMouseEvent(MouseEvent e,
JLayer<? extends V> l)
Processes mouse events occurring on the JLayer
or any of its subcomponents. |
protected void |
processMouseMotionEvent(MouseEvent e,
JLayer<? extends V> l)
Processes mouse motion event occurring on the JLayer
or any of its subcomponents. |
protected void |
processMouseWheelEvent(MouseWheelEvent e,
JLayer<? extends V> l)
Processes mouse wheel event occurring on the JLayer
or any of its subcomponents. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list. |
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener
list for a specific property. |
protected void |
repaintLayer()
Repaints all JLayer instances this LayerUI is set to. |
void |
uninstallUI(JComponent c)
Reverses the configuration which was previously set in the installUI(JComponent) method. |
void |
updateUI(JLayer<? extends V> l)
Invoked when JLayer.updateUI() is called
by the JLayer this LayerUI is set to. |
| Methods inherited from class javax.swing.plaf.ComponentUI |
|---|
contains, createUI, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, getPreferredSize, update |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LayerUI()
| Method Detail |
|---|
public void paint(Graphics g,
JComponent c)
Graphics object to
render the content of the component.
If g is not an instance of Graphics2D,
this method is no-op.
paint in class ComponentUIg - the Graphics context in which to paint;c - the component being painted;
it can be safely cast to JLayer<? extends V>configureGraphics(Graphics2D, JLayer),
paintLayer(Graphics2D, JLayer)
protected void configureGraphics(Graphics2D g2,
JLayer<? extends V> l)
paint(java.awt.Graphics, javax.swing.JComponent) method prior to
paintLayer(java.awt.Graphics2D, javax.swing.JLayer extends V>) to configure the Graphics2D object.
The default implementation is empty.
g2 - the Graphics2D object to configurel - the JLayer being paintedpaintLayer(Graphics2D, JLayer)
protected void paintLayer(Graphics2D g2,
JLayer<? extends V> l)
paint(java.awt.Graphics, javax.swing.JComponent) method,
subclasses should override this method
to perform any custom painting operations.
The default implementation paints the passed JLayer as is.
g2 - the Graphics2D context in which to paintl - the JLayer being paintedconfigureGraphics(Graphics2D, JLayer)
public void eventDispatched(AWTEvent e,
JLayer<? extends V> l)
AWTEvents for JLayer
and all its subcomponents to this LayerUI instance.
To enable the AWTEvents of a particular type,
you call JLayer.setLayerEventMask(long)
in installUI(javax.swing.JComponent)
and set the layer event mask to 0
in uninstallUI(javax.swing.JComponent) after that.
By default this method calls the appropriate
process<event type>Event
method for the given class of event.
e - the event to be dispatchedl - the layer this LayerUI is set toJLayer.setLayerEventMask(long),
installUI(javax.swing.JComponent),
uninstallUI(javax.swing.JComponent),
processComponentEvent(java.awt.event.ComponentEvent, javax.swing.JLayer extends V>),
processFocusEvent(java.awt.event.FocusEvent, javax.swing.JLayer extends V>),
processKeyEvent(java.awt.event.KeyEvent, javax.swing.JLayer extends V>),
processMouseEvent(java.awt.event.MouseEvent, javax.swing.JLayer extends V>),
processMouseMotionEvent(java.awt.event.MouseEvent, javax.swing.JLayer extends V>),
processInputMethodEvent(java.awt.event.InputMethodEvent, javax.swing.JLayer extends V>),
processHierarchyEvent(java.awt.event.HierarchyEvent, javax.swing.JLayer extends V>),
processMouseWheelEvent(java.awt.event.MouseWheelEvent, javax.swing.JLayer extends V>)
protected void processComponentEvent(ComponentEvent e,
JLayer<? extends V> l)
JLayer
or any of its subcomponents.
This method is not called unless component events are
enabled for the JLayer objects, this LayerUI is set to.
Component events are enabled in the overridden installUI(javax.swing.JComponent) method
and should be disabled in the uninstallUI(javax.swing.JComponent) method after that.
public void installUI(JComponent c) {
super.installUI(c);
JLayer l = (JLayer) c;
l.setLayerEventMask(AWTEvent.COMPONENT_EVENT_MASK);
}
public void unistallUI(JComponent c) {
super.uninstallUI(c);
JLayer l = (JLayer) c;
l.setLayerEventMask(0);
}
e - the ComponentEvent to be processedl - the layer this LayerUI instance is set toJLayer.setLayerEventMask(long),
installUI(javax.swing.JComponent),
uninstallUI(javax.swing.JComponent)
protected void processFocusEvent(FocusEvent e,
JLayer<? extends V> l)
JLayer
or any of its subcomponents.
This method is not called unless focus events are
enabled for the JLayer objects, this LayerUI is set to.
Focus events are enabled in the overridden installUI(javax.swing.JComponent) method
and should be disabled in the uninstallUI(javax.swing.JComponent) method after that.
public void installUI(JComponent c) {
super.installUI(c);
JLayer l = (JLayer) c;
l.setLayerEventMask(AWTEvent.FOCUS_EVENT_MASK);
}
public void unistallUI(JComponent c) {
super.uninstallUI(c);
JLayer l = (JLayer) c;
l.setLayerEventMask(0);
}
e - the FocusEvent to be processedl - the layer this LayerUI instance is set toJLayer.setLayerEventMask(long),
installUI(javax.swing.JComponent),
uninstallUI(javax.swing.JComponent)
protected void processKeyEvent(KeyEvent e,
JLayer<? extends V> l)
JLayer
or any of its subcomponents.
This method is not called unless key events are
enabled for the JLayer objects, this LayerUI is set to.
Key events are enabled in the overridden installUI(javax.swing.JComponent) method
and should be disabled in the uninstallUI(javax.swing.JComponent) method after that.
public void installUI(JComponent c) {
super.installUI(c);
JLayer l = (JLayer) c;
l.setLayerEventMask(AWTEvent.KEY_EVENT_MASK);
}
public void unistallUI(JComponent c) {
super.uninstallUI(c);
JLayer l = (JLayer) c;
l.setLayerEventMask(0);
}
e - the KeyEvent to be processedl - the layer this LayerUI instance is set toJLayer.setLayerEventMask(long),
installUI(javax.swing.JComponent),
uninstallUI(javax.swing.JComponent)
protected void processMouseEvent(MouseEvent e,
JLayer<? extends V> l)
JLayer
or any of its subcomponents.
This method is not called unless mouse events are
enabled for the JLayer objects, this LayerUI is set to.
Mouse events are enabled in the overridden installUI(javax.swing.JComponent) method
and should be disabled in the uninstallUI(javax.swing.JComponent) method after that.
public void installUI(JComponent c) {
super.installUI(c);
JLayer l = (JLayer) c;
l.setLayerEventMask(AWTEvent.MOUSE_EVENT_MASK);
}
public void unistallUI(JComponent c) {
super.uninstallUI(c);
JLayer l = (JLayer) c;
l.setLayerEventMask(0);
}
e - the MouseEvent to be processedl - the layer this LayerUI instance is set toJLayer.setLayerEventMask(long),
installUI(javax.swing.JComponent),
uninstallUI(javax.swing.JComponent)
protected void processMouseMotionEvent(MouseEvent e,
JLayer<? extends V> l)
JLayer
or any of its subcomponents.
This method is not called unless mouse motion events are
enabled for the JLayer objects, this LayerUI is set to.
Mouse motion events are enabled in the overridden installUI(javax.swing.JComponent) method
and should be disabled in the uninstallUI(javax.swing.JComponent) method after that.
public void installUI(JComponent c) {
super.installUI(c);
JLayer l = (JLayer) c;
l.setLayerEventMask(AWTEvent.MOUSE_MOTION_EVENT_MASK);
}
public void unistallUI(JComponent c) {
super.uninstallUI(c);
JLayer l = (JLayer) c;
l.setLayerEventMask(0);
}
e - the MouseEvent to be processedl - the layer this LayerUI instance is set toJLayer.setLayerEventMask(long),
installUI(javax.swing.JComponent),
uninstallUI(javax.swing.JComponent)
protected void processMouseWheelEvent(MouseWheelEvent e,
JLayer<? extends V> l)
JLayer
or any of its subcomponents.
This method is not called unless mouse wheel events are
enabled for the JLayer objects, this LayerUI is set to.
Mouse wheel events are enabled in the overridden installUI(javax.swing.JComponent) method
and should be disabled in the uninstallUI(javax.swing.JComponent) method after that.
public void installUI(JComponent c) {
super.installUI(c);
JLayer l = (JLayer) c;
l.setLayerEventMask(AWTEvent.MOUSE_WHEEL_EVENT_MASK);
}
public void unistallUI(JComponent c) {
super.uninstallUI(c);
JLayer l = (JLayer) c;
l.setLayerEventMask(0);
}
e - the MouseEvent to be processedl - the layer this LayerUI instance is set toJLayer.setLayerEventMask(long),
installUI(javax.swing.JComponent),
uninstallUI(javax.swing.JComponent)
protected void processInputMethodEvent(InputMethodEvent e,
JLayer<? extends V> l)
JLayer
or any of its subcomponents.
This method is not called unless input events are
enabled for the JLayer objects, this LayerUI is set to.
Input events are enabled in the overridden installUI(javax.swing.JComponent) method
and should be disabled in the uninstallUI(javax.swing.JComponent) method after that.
public void installUI(JComponent c) {
super.installUI(c);
JLayer l = (JLayer) c;
l.setLayerEventMask(AWTEvent.INPUT_METHOD_EVENT_MASK);
}
public void unistallUI(JComponent c) {
super.uninstallUI(c);
JLayer l = (JLayer) c;
l.setLayerEventMask(0);
}
e - the InputMethodEvent to be processedl - the layer this LayerUI instance is set toJLayer.setLayerEventMask(long),
installUI(javax.swing.JComponent),
uninstallUI(javax.swing.JComponent)
protected void processHierarchyEvent(HierarchyEvent e,
JLayer<? extends V> l)
JLayer
or any of its subcomponents.
This method is not called unless hierarchy events are
enabled for the JLayer objects, this LayerUI is set to.
Hierarchy events are enabled in the overridden installUI(javax.swing.JComponent) method
and should be disabled in the uninstallUI(javax.swing.JComponent) method after that.
public void installUI(JComponent c) {
super.installUI(c);
JLayer l = (JLayer) c;
l.setLayerEventMask(AWTEvent.HIERARCHY_EVENT_MASK);
}
public void unistallUI(JComponent c) {
super.uninstallUI(c);
JLayer l = (JLayer) c;
l.setLayerEventMask(0);
}
e - the HierarchyEvent to be processedl - the layer this LayerUI instance is set toJLayer.setLayerEventMask(long),
installUI(javax.swing.JComponent),
uninstallUI(javax.swing.JComponent)
protected void processHierarchyBoundsEvent(HierarchyEvent e,
JLayer<? extends V> l)
JLayer
or any of its subcomponents.
This method is not called unless hierarchy bounds events are
enabled for the JLayer objects, this LayerUI is set to.
Hierarchy bounds events are enabled in the overridden installUI(javax.swing.JComponent)
method and should be disabled in the uninstallUI(javax.swing.JComponent) method after that.
public void installUI(JComponent c) {
super.installUI(c);
JLayer l = (JLayer) c;
l.setLayerEventMask(AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK);
}
public void unistallUI(JComponent c) {
super.uninstallUI(c);
JLayer l = (JLayer) c;
l.setLayerEventMask(0);
}
e - the HierarchyEvent to be processedl - the layer this LayerUI instance is set toJLayer.setLayerEventMask(long),
installUI(javax.swing.JComponent),
uninstallUI(javax.swing.JComponent)public void updateUI(JLayer<? extends V> l)
JLayer.updateUI() is called
by the JLayer this LayerUI is set to.
l - the JLayer which UI is updatedpublic void installUI(JComponent c)
JLayer this LayerUI is set to.
The default implementation registers the LayerUI
as a property change listener for the passed JLayer component.
installUI in class ComponentUIc - the JLayer component where this UI delegate is being installedComponentUI.uninstallUI(javax.swing.JComponent),
JComponent.setUI(javax.swing.plaf.ComponentUI),
JComponent.updateUI()public void uninstallUI(JComponent c)
installUI(JComponent) method.
The default implementation unregisters the property change listener
for the passed JLayer component.
uninstallUI in class ComponentUIc - the component from which this UI delegate is being removed.ComponentUI.installUI(javax.swing.JComponent),
JComponent.updateUI()public void addPropertyChangeListener(PropertyChangeListener listener)
listener is null,
no exception is thrown and no action is performed.
listener - the property change listener to be addedremovePropertyChangeListener(java.beans.PropertyChangeListener),
getPropertyChangeListeners(),
addPropertyChangeListener(String, java.beans.PropertyChangeListener)public void removePropertyChangeListener(PropertyChangeListener listener)
listener is null,
no exception is thrown and no action is performed.
listener - the PropertyChangeListener to be removedaddPropertyChangeListener(java.beans.PropertyChangeListener),
getPropertyChangeListeners(),
removePropertyChangeListener(String, PropertyChangeListener)public PropertyChangeListener[] getPropertyChangeListeners()
PropertyChangeListeners
or an empty array if no property change
listeners are currently registeredaddPropertyChangeListener(java.beans.PropertyChangeListener),
removePropertyChangeListener(java.beans.PropertyChangeListener),
getPropertyChangeListeners(String)
public void addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
propertyName or listener is null,
no exception is thrown and no action is taken.
propertyName - one of the property names listed abovelistener - the property change listener to be addedremovePropertyChangeListener(String, PropertyChangeListener),
getPropertyChangeListeners(String),
addPropertyChangeListener(String, PropertyChangeListener)
public void removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
PropertyChangeListener from the listener
list for a specific property. This method should be used to remove
PropertyChangeListeners
that were registered for a specific bound property.
If propertyName or listener is null,
no exception is thrown and no action is taken.
propertyName - a valid property namelistener - the PropertyChangeListener to be removedaddPropertyChangeListener(String, PropertyChangeListener),
getPropertyChangeListeners(String),
removePropertyChangeListener(PropertyChangeListener)public PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
propertyName - The name of the property being listened to
PropertyChangeListeners associated with
the named property; if no such listeners have been added or
if propertyName is null, an empty
array is returnedaddPropertyChangeListener(String, PropertyChangeListener),
removePropertyChangeListener(String, PropertyChangeListener),
getPropertyChangeListeners()
protected void firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
propertyName - the property whose value has changedoldValue - the property's previous valuenewValue - the property's new valueprotected void repaintLayer()
JLayer instances this LayerUI is set to.
Call this method when the state of this LayerUI is changed
and the visual appearance of its JLayer objects needs to be updated.
Component.repaint()
public void applyPropertyChange(PropertyChangeEvent evt,
JLayer<? extends V> l)
LayerUI when any of its property are changed
and enables updating every JLayer
this LayerUI instance is set to.
evt - the PropertyChangeEvent generated by this LayerUIl - the JLayer this LayerUI is set topublic Dimension getPreferredScrollableViewportSize(JLayer<? extends V> l)
l - the JLayer component where this UI delegate is being installed
Scrollable.getPreferredScrollableViewportSize()
public int getScrollableBlockIncrement(JLayer<? extends V> l,
Rectangle visibleRect,
int orientation,
int direction)
l - the JLayer component where this UI delegate is being installedvisibleRect - The view area visible within the viewportorientation - Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL.direction - Less than zero to scroll up/left, greater than zero for down/right.
Scrollable.getScrollableBlockIncrement(Rectangle, int, int)public boolean getScrollableTracksViewportHeight(JLayer<? extends V> l)
false to indicate that the height of the viewport does not
determine the height of the layer, unless the preferred height
of the layer is smaller than the height of the viewport.
l - the JLayer component where this UI delegate is being installed
Scrollable.getScrollableTracksViewportHeight()public boolean getScrollableTracksViewportWidth(JLayer<? extends V> l)
false to indicate that the width of the viewport does not
determine the width of the layer, unless the preferred width
of the layer is smaller than the width of the viewport.
l - the JLayer component where this UI delegate is being installed
Scrollable,
getScrollableTracksViewportWidth(JLayer)
public int getScrollableUnitIncrement(JLayer<? extends V> l,
Rectangle visibleRect,
int orientation,
int direction)
Scrolling containers, like JScrollPane, will use this method each time the user requests a unit scroll.
l - the JLayer component where this UI delegate is being installedvisibleRect - The view area visible within the viewportorientation - Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL.direction - Less than zero to scroll up/left, greater than zero for down/right.
Scrollable.getScrollableUnitIncrement(Rectangle, int, int)
public int getBaseline(JComponent c,
int width,
int height)
JLayer's view component is not null,
this calls the view's getBaseline() method.
Otherwise, the default implementation is called.
getBaseline in class ComponentUIc - JLayer to return baseline resize behavior forwidth - the width to get the baseline forheight - the height to get the baseline for
JComponent.getBaseline(int,int)public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c)
JLayer's view component is not null,
this calls the view's getBaselineResizeBehavior() method.
Otherwise, the default implementation is called.
getBaselineResizeBehavior in class ComponentUIc - JLayer to return baseline resize behavior for
JComponent.getBaseline(int, int)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||