E - component typeU - component UI typepublic abstract class AbstractPainter<E extends javax.swing.JComponent,U extends javax.swing.plaf.ComponentUI> extends java.lang.Object implements Painter<E,U>, BorderMethods
Painter| Modifier and Type | Field and Description |
|---|---|
protected E |
component
Component reference.
|
protected java.util.List<PainterListener> |
listeners
Painter listeners.
|
protected boolean |
ltr
Whether or not painted component has LTR orientation.
|
protected java.beans.PropertyChangeListener |
propertyChangeListener
Listeners.
|
protected U |
ui
Component UI reference.
|
| Constructor and Description |
|---|
AbstractPainter() |
| Modifier and Type | Method and Description |
|---|---|
void |
addPainterListener(PainterListener listener)
Adds new painter listener.
|
protected java.awt.Rectangle |
b(java.awt.Rectangle bounds,
java.awt.Insets limit)
Returns bounds reduced by specified insets.
|
protected void |
borderChange(javax.swing.border.Border border)
Performs various border-related operations.
|
java.awt.Insets |
getBorders()
Returns borders required for visual data provided by this painter.
|
java.awt.Insets |
getCompleteBorder()
Updates component border according to component's margin and padding and painter's borders.
|
java.awt.Dimension |
getPreferredSize()
Returns preferred size required for proper painting of visual data provided by this painter.
|
protected java.awt.Insets |
i(java.awt.Insets i1,
java.awt.Insets i2)
Returns combined insets.
|
protected java.awt.Insets |
i(java.awt.Insets insets,
int top,
int left,
int bottom,
int right)
Returns combined insets with the specified settings.
|
protected java.awt.Insets |
i(int top,
int left,
int bottom,
int right)
Returns insets with the specified settings.
|
void |
install(E c,
U ui)
Called when painter is installed onto some component.
|
protected void |
installPropertyChangeListener()
Installs listener that will inform about component property changes.
|
java.lang.Boolean |
isOpaque()
Returns whether visual data provided by this painter is opaque or not.
|
protected boolean |
isSectionPainter()
Returns whether or not this is a section painter.
|
protected boolean |
isSettingsUpdateAllowed()
Returns whether or not this painter is allowed to update component settings and visual state.
|
protected void |
orientationChange()
Performs various updates on orientation change.
|
protected java.awt.Point |
p(int x,
int y)
Returns point for the specified coordinates.
|
protected void |
propertyChange(java.lang.String property,
java.lang.Object oldValue,
java.lang.Object newValue)
Performs various updates on property changes.
|
void |
removePainterListener(PainterListener listener)
Removes painter listener.
|
void |
repaint()
Should be called when painter visual representation changes.
|
void |
repaint(int x,
int y,
int width,
int height)
Should be called when part of painter visual representation changes.
|
void |
repaint(java.awt.Rectangle bounds)
Should be called when part of painter visual representation changes.
|
void |
revalidate()
Should be called when painter size or border changes.
|
protected void |
saveOrientation()
Saves current component orientation state.
|
void |
uninstall(E c,
U ui)
Called when painter is installed into some component.
|
protected void |
uninstallPropertyChangeListener()
Uninstalls listener that is informing about component property changes.
|
void |
updateAll()
Should be called when painter size, border and visual representation changes.
|
void |
updateBorder()
Updates component with complete border.
|
void |
updateOpacity()
Should be called when painter opacity changes.
|
void |
updateOrientation()
Updates component orientation based on global orientation.
|
protected final transient java.util.List<PainterListener> listeners
protected transient java.beans.PropertyChangeListener propertyChangeListener
protected transient E extends javax.swing.JComponent component
protected transient U extends javax.swing.plaf.ComponentUI ui
protected transient boolean ltr
public void install(E c, U ui)
Painterpublic void uninstall(E c, U ui)
Painterpublic java.lang.Boolean isOpaque()
Painterpublic java.awt.Insets getBorders()
Painter
You may pass null in case additional borders aren't needed for this painter.
getBorders in interface Painter<E extends javax.swing.JComponent,U extends javax.swing.plaf.ComponentUI>null in case those aren't neededprotected boolean isSettingsUpdateAllowed()
protected boolean isSectionPainter()
protected void installPropertyChangeListener()
protected void uninstallPropertyChangeListener()
protected void propertyChange(java.lang.String property,
java.lang.Object oldValue,
java.lang.Object newValue)
property - modified propertyoldValue - old property valuenewValue - new property valueprotected void orientationChange()
protected void borderChange(javax.swing.border.Border border)
border - new borderprotected void saveOrientation()
public void updateOrientation()
public void updateBorder()
updateBorder in interface BorderMethodspublic java.awt.Insets getCompleteBorder()
public void repaint()
public void repaint(java.awt.Rectangle bounds)
bounds - part boundspublic void repaint(int x,
int y,
int width,
int height)
x - part bounds X coordinatey - part bounds Y coordinatewidth - part bounds widthheight - part bounds heightpublic void revalidate()
public void updateOpacity()
public void updateAll()
public java.awt.Dimension getPreferredSize()
PaintergetPreferredSize in interface Painter<E extends javax.swing.JComponent,U extends javax.swing.plaf.ComponentUI>public void addPainterListener(PainterListener listener)
PainteraddPainterListener in interface Painter<E extends javax.swing.JComponent,U extends javax.swing.plaf.ComponentUI>listener - painter listener to addPainterListenerpublic void removePainterListener(PainterListener listener)
PainterremovePainterListener in interface Painter<E extends javax.swing.JComponent,U extends javax.swing.plaf.ComponentUI>listener - painter listener to removePainterListenerprotected java.awt.Point p(int x,
int y)
x - X coordinatey - Y coordinateprotected java.awt.Insets i(int top,
int left,
int bottom,
int right)
top - the inset from the topleft - the inset from the leftbottom - the inset from the bottomright - the inset from the rightprotected java.awt.Insets i(java.awt.Insets insets,
int top,
int left,
int bottom,
int right)
insets - base insetstop - the inset from the topleft - the inset from the leftbottom - the inset from the bottomright - the inset from the rightprotected java.awt.Insets i(java.awt.Insets i1,
java.awt.Insets i2)
i1 - first insetsi2 - second insetsprotected java.awt.Rectangle b(java.awt.Rectangle bounds,
java.awt.Insets limit)
bounds - bounds to reducelimit - limiting insets