public class FlashForeground
extends java.lang.Object
implements java.lang.Runnable
Title: Flash foreground
Description: Eye candy modifying the foreground color of a component
Copyright: Copyright (c) 2004-2014, David Read
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Modifier and Type | Field and Description |
---|---|
private int |
blueChange
Amount of change for the blue component of the RGB color at each step in
the coloring cycle
|
private int |
blueModulus
The modulus value of the iteration counter for changing the blue component
of the RGB color
|
private int |
blueOff
Blue color value for RGB coloring when the flash is "off"
|
private int |
blueOn
Blue color value for RGB coloring when the flash is "on"
|
private int |
blueValue
Current blue value in the RGB color
|
private java.awt.Component |
component
The component backing this instance
|
private int |
currentValue
The current value of the iteration counter cycling through the component
color ranges from "on" to "off"
|
private int |
direction
The current iteration direction (1=up or -1=down).
|
private int |
greenChange
Amount of change for the green component of the RGB color at each step in
the coloring cycle
|
private int |
greenModulus
The modulus value of the iteration counter for changing the green component
of the RGB color
|
private int |
greenOff
Green color value for RGB coloring when the flash is "off"
|
private int |
greenOn
Green color value for RGB coloring when the flash is "on"
|
private int |
greenValue
Current green value in the RGB color
|
private static org.apache.log4j.Logger |
LOGGER
Logger
|
private int |
maxChange
The maximum range of the iteration counter to cycle through the component
color ranges from "on" to "off"
|
private int |
msDelay
Delay time when cycling the steps between "on" and "off" colors
|
private java.awt.Color |
offColor
The color to display when the flash is "off"
|
private java.awt.Color |
onColor
The color to display when the flash is "on"
|
private int |
redChange
Amount of change for the red component of the RGB color at each step in the
coloring cycle
|
private int |
redModulus
The modulus value of the iteration counter for changing the red component
of the RGB color
|
private int |
redOff
Red color value for RGB coloring when the flash is "off"
|
private int |
redOn
Red color value for RGB coloring when the flash is "on"
|
private int |
redValue
Current red value in the RGB color
|
Constructor and Description |
---|
FlashForeground(java.awt.Component aComp,
java.awt.Color aOnColor,
java.awt.Color aOffColor,
int aMSDelay)
Create a FlashForeground instance, associated with a specific component.
|
Modifier and Type | Method and Description |
---|---|
private void |
computeChange()
Compute the RGB values for the "On" and "Off" colors.
|
private java.awt.Color |
nextColor()
Calculate the next color to be used for the foreground.
|
void |
run()
Oscillate the component colors until an interrupt is
received.
|
private static final org.apache.log4j.Logger LOGGER
private java.awt.Component component
private java.awt.Color onColor
private java.awt.Color offColor
private int msDelay
private int redOn
private int redOff
private int greenOn
private int greenOff
private int blueOn
private int blueOff
private int redChange
private int greenChange
private int blueChange
private int redValue
private int greenValue
private int blueValue
private int redModulus
private int greenModulus
private int blueModulus
private int maxChange
private int currentValue
private int direction
public FlashForeground(java.awt.Component aComp, java.awt.Color aOnColor, java.awt.Color aOffColor, int aMSDelay)
aComp
- The component whose foreground color is controlled by this
instanceaOnColor
- The color used to indicate some activity is running.aOffColor
- The default foreground color of the component.aMSDelay
- The number of milliseconds between color changes. Note that
the colors change by gradation, so this number should be small.private java.awt.Color nextColor()
private void computeChange()
public void run()
run
in interface java.lang.Runnable