Package org.jdesktop.swingx.icon
Class PainterIcon
java.lang.Object
org.jdesktop.swingx.icon.PainterIcon
- All Implemented Interfaces:
Icon
,SwingConstants
,JXIcon
,SizingConstants
Impelmentation of JXIcon interface
- Author:
- EUG https://github.com/homebeaver (rotation + point/axis reflection)
-
Field Summary
Fields inherited from interface org.jdesktop.swingx.icon.SizingConstants
ACTION_ICON, BUTTON_ICON, L, LAUNCHER_ICON, M, N, S, SMALL_ICON, XL, XS, XXL
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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
int
double
override the constant default (no rotation) defined in JXIconboolean
override the default defined in JXIcon (no reflection)void
void
setPainter
(Painter<? extends Component> painter) void
setReflection
(boolean horizontal, boolean vertical) A hint for point/axis reflection (mirroring) the icon when painting.void
setRotation
(double theta) A hint to rotate the icon when paintingMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jdesktop.swingx.icon.JXIcon
setReflection, setRotation
-
Constructor Details
-
PainterIcon
public PainterIcon(int width, int height) -
PainterIcon
-
-
Method Details
-
setReflection
public void setReflection(boolean horizontal, boolean vertical) A hint for point/axis reflection (mirroring) the icon when painting.setReflection(true, true)
means point reflection- Specified by:
setReflection
in interfaceJXIcon
- Parameters:
horizontal
- will mirror the icon horizontal (X axis)vertical
- will mirror the icon vertical (Y axis)
-
isReflection
public boolean isReflection()override the default defined in JXIcon (no reflection)- Specified by:
isReflection
in interfaceJXIcon
- Returns:
- true if there is any reflection, point reflection or mirroring
-
setRotation
public void setRotation(double theta) A hint to rotate the icon when painting- Specified by:
setRotation
in interfaceJXIcon
- Parameters:
theta
- the angle of rotation in radians, zero means no rotation
-
getRotation
public double getRotation()override the constant default (no rotation) defined in JXIcon- Specified by:
getRotation
in interfaceJXIcon
- Returns:
- the angle of rotation in radians
-
getPainter
-
setPainter
-
paintIcon
-
getIconHeight
public int getIconHeight()- Specified by:
getIconHeight
in interfaceIcon
-
getIconWidth
public int getIconWidth()- Specified by:
getIconWidth
in interfaceIcon
-