- java.lang.Object
-
- org.icepdf.ri.common.CompoundIcon
-
- All Implemented Interfaces:
Icon
public class CompoundIcon extends Object implements Icon
The CompoundIcon will paint two, or more, Icons as a single Icon. The Icons are painted in the order in which they are added.The Icons are layed out on the specified axis:
- X-Axis (horizontally)
- Y-Axis (vertically)
- Z-Axis (stacked)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCompoundIcon.Axis
-
Constructor Summary
Constructors Constructor Description CompoundIcon(Icon... icons)Convenience constructor for creating a CompoundIcon where the icons are laid out on the X-AXIS, the gap is 0 and the X/Y alignments will default to CENTER.CompoundIcon(CompoundIcon.Axis axis, int gap, float alignmentX, float alignmentY, Icon... icons)Create a CompoundIcon specifying all the properties.CompoundIcon(CompoundIcon.Axis axis, int gap, Icon... icons)Convenience contrusctor for creating a CompoundIcon where the X/Y alignments will default to CENTER.CompoundIcon(CompoundIcon.Axis axis, Icon... icons)Convenience constructor for creating a CompoundIcon where the gap is 0 and the X/Y alignments will default to CENTER.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description floatgetAlignmentX()Get the alignment of the icon on the x-axisfloatgetAlignmentY()Get the alignment of the icon on the y-axisCompoundIcon.AxisgetAxis()Get the Axis along which each icon is painted.intgetGap()Get the gap between each iconIcongetIcon(int index)Get the Icon at the specified index.intgetIconCount()Get the number of Icons contained in this CompoundIcon.intgetIconHeight()Gets the height of this icon.intgetIconWidth()Gets the width of this icon.voidpaintIcon(Component c, Graphics g, int x, int y)Paint the icons of this compound icon at the specified location
-
-
-
Field Detail
-
TOP
public static final float TOP
- See Also:
- Constant Field Values
-
LEFT
public static final float LEFT
- See Also:
- Constant Field Values
-
CENTER
public static final float CENTER
- See Also:
- Constant Field Values
-
BOTTOM
public static final float BOTTOM
- See Also:
- Constant Field Values
-
RIGHT
public static final float RIGHT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CompoundIcon
public CompoundIcon(Icon... icons)
Convenience constructor for creating a CompoundIcon where the icons are laid out on the X-AXIS, the gap is 0 and the X/Y alignments will default to CENTER.- Parameters:
icons- the Icons to be painted as part of the CompoundIcon
-
CompoundIcon
public CompoundIcon(CompoundIcon.Axis axis, Icon... icons)
Convenience constructor for creating a CompoundIcon where the gap is 0 and the X/Y alignments will default to CENTER.- Parameters:
axis- the axis used to lay out the icons for painting. Must be one of the Axis enums: X_AXIS, Y_AXIS, Z_Axis.icons- the Icons to be painted as part of the CompoundIcon
-
CompoundIcon
public CompoundIcon(CompoundIcon.Axis axis, int gap, Icon... icons)
Convenience contrusctor for creating a CompoundIcon where the X/Y alignments will default to CENTER.- Parameters:
axis- the axis used to lay out the icons for painting Must be one of the Axis enums: X_AXIS, Y_AXIS, Z_Axis.gap- the gap between the iconsicons- the Icons to be painted as part of the CompoundIcon
-
CompoundIcon
public CompoundIcon(CompoundIcon.Axis axis, int gap, float alignmentX, float alignmentY, Icon... icons)
Create a CompoundIcon specifying all the properties.- Parameters:
axis- the axis used to lay out the icons for painting Must be one of the Axis enums: X_AXIS, Y_AXIS, Z_Axis.gap- the gap between the iconsalignmentX- the X alignment of the icons. Common values are LEFT, CENTER, RIGHT. Can be any value between 0.0 and 1.0alignmentY- the Y alignment of the icons. Common values are TOP, CENTER, BOTTOM. Can be any value between 0.0 and 1.0icons- the Icons to be painted as part of the CompoundIcon
-
-
Method Detail
-
getAxis
public CompoundIcon.Axis getAxis()
Get the Axis along which each icon is painted.- Returns:
- the Axis
-
getGap
public int getGap()
Get the gap between each icon- Returns:
- the gap in pixels
-
getAlignmentX
public float getAlignmentX()
Get the alignment of the icon on the x-axis- Returns:
- the alignment
-
getAlignmentY
public float getAlignmentY()
Get the alignment of the icon on the y-axis- Returns:
- the alignment
-
getIconCount
public int getIconCount()
Get the number of Icons contained in this CompoundIcon.- Returns:
- the total number of Icons
-
getIcon
public Icon getIcon(int index)
Get the Icon at the specified index.- Parameters:
index- the index of the Icon to be returned- Returns:
- the Icon at the specifed index
- Throws:
IndexOutOfBoundsException- if the index is out of range
-
getIconWidth
public int getIconWidth()
Gets the width of this icon.- Specified by:
getIconWidthin interfaceIcon- Returns:
- the width of the icon in pixels.
-
getIconHeight
public int getIconHeight()
Gets the height of this icon.- Specified by:
getIconHeightin interfaceIcon- Returns:
- the height of the icon in pixels.
-
-