com.alee.extended.painter
Interface Painter<E extends javax.swing.JComponent>
- Type Parameters:
E
- component type
- All Known Subinterfaces:
- LabelPainter<E>, PanelPainter<E>, PopupMenuPainter<E>, ScrollBarButtonPainter<E>, ScrollBarPainter<E>
- All Known Implementing Classes:
- AbstractPainter, AdaptiveLabelPainter, AdaptivePainter, AdaptivePanelPainter, AdaptivePopupMenuPainter, AdaptiveScrollBarButtonPainter, AdaptiveScrollBarPainter, AlphaLayerPainter, BorderPainter, ButtonPaintersExample.SeaGlassButtonPainter, ColorPainter, ComplexExample.ShadeBackgroundPainter, DashedBorderPainter, GenericCellEditorPainter, HotkeyTipPainter, InnerShadePainter, NinePatchIconPainter, NinePatchStatePainter, NPDecorationPainter, NPLabelPainter, NPPanelPainter, NPScrollBarButtonPainter, NPScrollBarPainter, TexturePainter, TitledBorderPainter, WebBreadcrumbButtonPainter, WebBreadcrumbLabelPainter, WebBreadcrumbPanelPainter, WebBreadcrumbToggleButtonPainter, WebButtonPopup.WebButtonPopupPainter, WebComboBoxElementPainter, WebComponentPanel.WebSelectablePanelPainter, WebDecorationPainter, WebHotkeyLabelPainter, WebLabelPainter, WebPanelPainter, WebPopOverPainter, WebPopupMenuPainter, WebPopupPainter, WebScrollBarButtonPainter, WebScrollBarPainter, WebStylePainter, WebVerticalLabelPainter
public interface Painter<E extends javax.swing.JComponent>
This interface provides basic methods for component view painting.
Using painters you can quickly and easily change Swing and WebLaF components view.
You might want to use single painter for multiply components, but be aware that whether or not single painter can work with multiply
components at once depends only on its own way of implementation. In most cases painters which does some animation won't work well with
multiply components unless noted otherwise.
- Author:
- Mikle Garin
- See Also:
AbstractPainter
Method Summary |
void |
addPainterListener(PainterListener listener)
Adds new painter listener. |
java.awt.Insets |
getMargin(E c)
Returns margin required for visual data provided by this painter. |
java.awt.Dimension |
getPreferredSize(E c)
Returns preferred size required for proper painting of visual data provided by this painter. |
void |
install(E c)
Called when painter is intalled into some component. |
java.lang.Boolean |
isOpaque(E c)
Returns whether visual data provided by this painter is opaque or not. |
void |
paint(java.awt.Graphics2D g2d,
java.awt.Rectangle bounds,
E c)
Paints visual data onto the component graphics. |
void |
removePainterListener(PainterListener listener)
Removes painter listener. |
void |
uninstall(E c)
Called when painter is intalled into some component. |
install
void install(E c)
- Called when painter is intalled into some component.
You might want to use this method to add custom component listeners or modify component settings.
- Parameters:
c
- component to process
uninstall
void uninstall(E c)
- Called when painter is intalled into some component.
You might want to use this method to add custom component listeners or modify component settings.
- Parameters:
c
- component to process
isOpaque
java.lang.Boolean isOpaque(E c)
- Returns whether visual data provided by this painter is opaque or not.
Returned value might affect component opacity depending on painter support inside that component UI.
Simply return null if you don't want to change default component opacity.
- Parameters:
c
- component to process
- Returns:
- true if visual data provided by this painter is opaque, false otherwise
getPreferredSize
java.awt.Dimension getPreferredSize(E c)
- Returns preferred size required for proper painting of visual data provided by this painter.
This should not take into account any sizes not related to this painter settings (for example text size on button).
- Parameters:
c
- component to process
- Returns:
- preferred size required for proper painting of visual data provided by this painter
getMargin
java.awt.Insets getMargin(E c)
- Returns margin required for visual data provided by this painter.
This margin is usually added to component's margin when the final component border is calculated.
You may pass null instead of zero margin - it will simply be ignored in that case.
- Parameters:
c
- component to process
- Returns:
- margin required for visual data provided by this painter or null for zero margin
paint
void paint(java.awt.Graphics2D g2d,
java.awt.Rectangle bounds,
E c)
- Paints visual data onto the component graphics.
Provided graphics and component are taken directly from component UI paint method.
Provided bounds are usually fake (zero location, component size) but in some cases it might be specified by componentUI.
- Parameters:
g2d
- component graphicsbounds
- bounds for painter visual datac
- component to process
addPainterListener
void addPainterListener(PainterListener listener)
- Adds new painter listener.
- Parameters:
listener
- painter listener to add
removePainterListener
void removePainterListener(PainterListener listener)
- Removes painter listener.
- Parameters:
listener
- painter listener to remove