|
swingx Version 2009-07-31 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JLabel
org.jdesktop.swingx.renderer.JRendererLabel
public class JRendererLabel
A JLabel
optimized for usage in renderers and
with a minimal background painter support.
Note: the painter support will be switched to painter_work as soon it enters main. The reasoning for the performance-overrides is copied from core:
The standard JLabel
component was not
designed to be used this way and we want to avoid
triggering a revalidate
each time the
cell is drawn. This would greatly decrease performance because the
revalidate
message would be
passed up the hierarchy of the container to determine whether any other
components would be affected.
As the renderer is only parented for the lifetime of a painting operation
we similarly want to avoid the overhead associated with walking the
hierarchy for painting operations.
So this class
overrides the validate
, invalidate
,
revalidate
, repaint
, and
firePropertyChange
methods to be
no-ops and override the isOpaque
method solely to improve
performance. If you write your own renderer component,
please keep this performance consideration in mind.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JLabel |
---|
JLabel.AccessibleJLabel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected Painter |
painter
|
Fields inherited from class javax.swing.JLabel |
---|
labelFor |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.SwingConstants |
---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
JRendererLabel()
|
Method Summary | |
---|---|
void |
firePropertyChange(String propertyName,
boolean oldValue,
boolean newValue)
Overridden for performance reasons. |
protected void |
firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
Overridden for performance reasons. |
Painter |
getPainter()
|
void |
invalidate()
Overridden for performance reasons. |
boolean |
isOpaque()
Overridden for performance reasons. |
protected void |
paintComponent(Graphics g)
Overridden to inject Painter's painting. |
protected void |
paintComponentWithPainter(Graphics2D g)
PRE: painter ! |
void |
repaint()
Overridden for performance reasons. |
void |
repaint(long tm,
int x,
int y,
int width,
int height)
Overridden for performance reasons. |
void |
repaint(Rectangle r)
Overridden for performance reasons. |
void |
revalidate()
Overridden for performance reasons. |
void |
setPainter(Painter painter)
|
void |
setToolTipText(String text)
Overridden to not automatically de/register itself from/to the ToolTipManager. |
void |
validate()
Overridden for performance reasons. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Painter painter
Constructor Detail |
---|
public JRendererLabel()
Method Detail |
---|
public boolean isOpaque()
PENDING: Think about Painters and opaqueness?
isOpaque
in class JComponent
public void setPainter(Painter painter)
setPainter
in interface PainterAware
public Painter getPainter()
getPainter
in interface PainterAware
protected void paintComponent(Graphics g)
Overridden to inject Painter's painting.
TODO: cleanup logic - see JRendererCheckBox.
paintComponent
in class JComponent
protected void paintComponentWithPainter(Graphics2D g)
g
- public void setToolTipText(String text)
Overridden to not automatically de/register itself from/to the ToolTipManager. As rendering component it is not considered to be active in any way, so the manager must not listen.
setToolTipText
in class JComponent
public void invalidate()
invalidate
in class Container
public void validate()
validate
in class Container
public void revalidate()
revalidate
in class JComponent
public void repaint(long tm, int x, int y, int width, int height)
repaint
in class JComponent
public void repaint(Rectangle r)
repaint
in class JComponent
public void repaint()
repaint
in class Component
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue)
firePropertyChange
in class Component
public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
firePropertyChange
in class JComponent
|
swingx Version 2009-07-31 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |