textbender.o.awt
Class ColorPair

java.lang.Object
  extended by ColorPair
All Implemented Interfaces:
Cloneable

public final class ColorPair
extends Object
implements Cloneable

A background/foreground colour-pair.


Nested Class Summary
static class ColorPair.X
          Colour-pair utilities.
 
Field Summary
 Color background
          The background colour.
 Color foreground
          The foreground colour.
 
Constructor Summary
ColorPair()
          Creates a ColorPair, initially with null values.
ColorPair(Color background, Color foreground)
          Creates a ColorPair.
ColorPair(Component component)
          Creates a ColorPair, initialized from a component.
 
Method Summary
 ColorPair clone()
           
 boolean equals(Object o)
          Returns true iff both colours are equal.
 Color getBackground()
          Returns the background colour.
 Color getForeground()
          Returns the foreground colour.
 void invert()
          Interchanges background and foreground.
 void setBackground(Color newBackground)
          Sets the background colour, per getBackground().
 void setForeground(Color newForeground)
          Sets the foreground colour, per getForeground().
 void setFromComponent(Component component)
          Sets the colour-pair from the background and foreground of a component.
 void setOnComponent(Component component)
          Sets the component background and foreground to the colour-pair.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

background

public Color background
The background colour.


foreground

public Color foreground
The foreground colour.

Constructor Detail

ColorPair

public ColorPair()
Creates a ColorPair, initially with null values.


ColorPair

public ColorPair(Color background,
                 Color foreground)
Creates a ColorPair.

Parameters:
background - per getBackground()
foreground - per getForeground()

ColorPair

public ColorPair(Component component)
Creates a ColorPair, initialized from a component.

Parameters:
component - per setFromComponent()
Method Detail

getBackground

public Color getBackground()
Returns the background colour.


setBackground

public void setBackground(Color newBackground)
Sets the background colour, per getBackground().


getForeground

public Color getForeground()
Returns the foreground colour.


setForeground

public void setForeground(Color newForeground)
Sets the foreground colour, per getForeground().


invert

public void invert()
Interchanges background and foreground.


setFromComponent

public void setFromComponent(Component component)
Sets the colour-pair from the background and foreground of a component.


setOnComponent

public void setOnComponent(Component component)
Sets the component background and foreground to the colour-pair.


clone

public ColorPair clone()
Overrides:
clone in class Object

equals

public boolean equals(Object o)
Returns true iff both colours are equal.

Overrides:
equals in class Object