uk.ac.starlink.ast.gui
Class ColourIcon

java.lang.Object
  extended by uk.ac.starlink.ast.gui.ColourIcon
All Implemented Interfaces:
Icon

public class ColourIcon
extends Object
implements Icon

Creates a rectangular Icon that is painted with a given colour and has a coloured border of a specified thickness.

Since:
$Date$, 26-SEP-2000
Version:
$Id$
Author:
Peter W. Draper

Field Summary
protected  Color borderColour
          Border colour of the icon.
protected  int borderWidth
          Width of the coloured border.
protected  Color mainColour
          Colour of the icon.
protected  int totalHeight
          Height of the Icon.
protected  int totalWidth
          Width of the icon.
 
Constructor Summary
ColourIcon(Color colour)
          Create an icon with the given colour and defaults.
ColourIcon(Color mainColour, int width, int height, Color borderColour, int thickness)
          Create an icon with the given colours and sizes.
 
Method Summary
 Color getBorderColour()
          Get the border colour.
 int getBorderWidth()
          Get the border width.
 int getIconHeight()
          Get the icon height.
 int getIconWidth()
          Get the icon width.
 Color getMainColour()
          Get the icon colour.
 void paintIcon(Component c, Graphics g, int x, int y)
          Re-draw the Icon.
 void setBorderColour(Color borderColour)
          Set the border colour.
 void setBorderWidth(int width)
          Set the border width.
 void setIconHeight(int height)
          Set the icon height.
 void setIconWidth(int width)
          Set the icon width.
 void setMainColour(Color mainColour)
          Set the icon colour.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mainColour

protected Color mainColour
Colour of the icon.


borderColour

protected Color borderColour
Border colour of the icon.


totalWidth

protected int totalWidth
Width of the icon.


totalHeight

protected int totalHeight
Height of the Icon.


borderWidth

protected int borderWidth
Width of the coloured border.

Constructor Detail

ColourIcon

public ColourIcon(Color mainColour,
                  int width,
                  int height,
                  Color borderColour,
                  int thickness)
Create an icon with the given colours and sizes.

Parameters:
mainColour - the colour.
width - the total width.
height - the total height.
borderColour - the colour of the border.
thickness - the thickness of the border.

ColourIcon

public ColourIcon(Color colour)
Create an icon with the given colour and defaults.

Parameters:
mainColour - the colour.
Method Detail

setMainColour

public void setMainColour(Color mainColour)
Set the icon colour.

Parameters:
mainColour - the colour.

getMainColour

public Color getMainColour()
Get the icon colour.

Returns:
the icon colour.

setBorderColour

public void setBorderColour(Color borderColour)
Set the border colour.

Parameters:
borderColour - the colour.

getBorderColour

public Color getBorderColour()
Get the border colour.

Returns:
the border colour.

setIconWidth

public void setIconWidth(int width)
Set the icon width.

Parameters:
width - the total width of the icon.

getIconWidth

public int getIconWidth()
Get the icon width.

Specified by:
getIconWidth in interface Icon
Returns:
the total width of the icon.

setIconHeight

public void setIconHeight(int height)
Set the icon height.

Parameters:
height - the total width of the icon.

getIconHeight

public int getIconHeight()
Get the icon height.

Specified by:
getIconHeight in interface Icon
Returns:
the total height of the icon.

setBorderWidth

public void setBorderWidth(int width)
Set the border width.

Parameters:
width - the width of the border region.

getBorderWidth

public int getBorderWidth()
Get the border width.

Returns:
the width of the border region.

paintIcon

public void paintIcon(Component c,
                      Graphics g,
                      int x,
                      int y)
Re-draw the Icon.

Specified by:
paintIcon in interface Icon


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.