Package jmri.util.org.mitre.jawb.swing
Class CompositeIcon
java.lang.Object
jmri.util.org.mitre.jawb.swing.CompositeIcon
- All Implemented Interfaces:
Icon,SwingConstants
CompositeIcon is an Icon implementation which draws two icons with a
specified relative position.
LEFT, RIGHT, TOP, BOTTOM specify how icon1 is drawn relative
to icon2
CENTER: icon1 is drawn first, icon2 is drawn over it and with horizontal and vertical orientations within the alloted space
It's useful with VTextIcon when you want an icon with your text: if icon1 is the graphic icon and icon2 is the VTextIcon, you get a similar effect to a JLabel with a graphic icon and text
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) int(package private) Icon(package private) Icon(package private) int(package private) intFields 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
ConstructorsConstructorDescriptionCompositeIcon(Icon icon1, Icon icon2) Create a CompositeIcon from the specified Icons, using the default relative position (icon1 above icon2) and orientations (centered horizontally and vertically)CompositeIcon(Icon icon1, Icon icon2, int position) Create a CompositeIcon from the specified Icons, using the specified relative position and default orientations (centered horizontally and vertically)CompositeIcon(Icon icon1, Icon icon2, int position, int horizontalOrientation, int verticalOrientation) Create a CompositeIcon from the specified Icons, using the specified relative position and orientations -
Method Summary
Modifier and TypeMethodDescriptionintReturns the icon's height.intReturns the icon's width.voidDraw the icon at the specified location.(package private) voidpaintIcon(Component c, Graphics g, Icon icon, int x, int y, int width, int height, int horizontalOrientation, int verticalOrientation) Paints one icon in the specified rectangle with the given orientations
-
Field Details
-
fIcon1
-
fIcon2
-
fPosition
int fPosition -
fHorizontalOrientation
-
fVerticalOrientation
-
-
Constructor Details
-
CompositeIcon
Create a CompositeIcon from the specified Icons, using the default relative position (icon1 above icon2) and orientations (centered horizontally and vertically)- Parameters:
icon1- icon 1icon2- icon 2
-
CompositeIcon
Create a CompositeIcon from the specified Icons, using the specified relative position and default orientations (centered horizontally and vertically)- Parameters:
icon1- icon 1icon2- icon 2position- icon position
-
CompositeIcon
public CompositeIcon(Icon icon1, Icon icon2, int position, int horizontalOrientation, int verticalOrientation) Create a CompositeIcon from the specified Icons, using the specified relative position and orientations- Parameters:
icon1- icon 1icon2- icon 2position- icon positinhorizontalOrientation- horizontal orientationverticalOrientation- vertical orientation
-
-
Method Details
-
paintIcon
Draw the icon at the specified location. Icon implementations may use the Component argument to get properties useful for painting, e.g. the foreground or background color. -
paintIcon
void paintIcon(Component c, Graphics g, Icon icon, int x, int y, int width, int height, int horizontalOrientation, int verticalOrientation) Paints one icon in the specified rectangle with the given orientations- Parameters:
c- componentg- graphicicon- iconx- x locationy- y locationwidth- width of iconheight- height of iconhorizontalOrientation- horizontal orientationverticalOrientation- vertical orientation
-
getIconWidth
Returns the icon's width.- Specified by:
getIconWidthin interfaceIcon- Returns:
- an int specifying the fixed width of the icon.
-
getIconHeight
Returns the icon's height.- Specified by:
getIconHeightin interfaceIcon- Returns:
- an int specifying the fixed height of the icon.
-