org.crosswire.common.swing
Class CompositeIcon

java.lang.Object
  extended by org.crosswire.common.swing.CompositeIcon
All Implemented Interfaces:
Icon

public class CompositeIcon
extends Object
implements Icon

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

Author:
Lee Ann Rucker [LRucker at mac dot com] from http://www.macdevcenter.com/pub/a/mac/2002/03/22/vertical_text.html, DM Smith [dmsmith555 at yahoo dot com]
See Also:
for license details. The copyright to this program is held by it's authors.

Field Summary
private  int horizontalOrientation
           
private  Icon icon1
           
private  Icon icon2
           
private  int position
           
private  int verticalOrientation
           
 
Constructor Summary
CompositeIcon(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
 int getIconHeight()
           
 int getIconWidth()
           
private  void paintIcon(Component c, Graphics g, Icon icon, int x, int y, int width, int height, int hOrientation, int vOrientation)
          Paints one icon in the specified rectangle with the given orientations.
 void paintIcon(Component c, Graphics g, int x, int y)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

icon1

private Icon icon1

icon2

private Icon icon2

position

private int position

horizontalOrientation

private int horizontalOrientation

verticalOrientation

private int verticalOrientation
Constructor Detail

CompositeIcon

public CompositeIcon(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).

Parameters:
icon1 - Icon
icon2 - Icon

CompositeIcon

public 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).

Parameters:
icon1 - Icon
icon2 - Icon
position - int

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
icon2 - Icon
position - int
horizontalOrientation - int
verticalOrientation - int
Method Detail

getIconHeight

public int getIconHeight()
Specified by:
getIconHeight in interface Icon

getIconWidth

public int getIconWidth()
Specified by:
getIconWidth in interface Icon

paintIcon

public void paintIcon(Component c,
                      Graphics g,
                      int x,
                      int y)
Specified by:
paintIcon in interface Icon

paintIcon

private void paintIcon(Component c,
                       Graphics g,
                       Icon icon,
                       int x,
                       int y,
                       int width,
                       int height,
                       int hOrientation,
                       int vOrientation)
Paints one icon in the specified rectangle with the given orientations.

Parameters:
c - Component
g - Graphics
icon - Icon
x - int
y - int
width - int
height - int
hOrientation - int
vOrientation - int

Copyright ยจ 2003-2006