ucar.unidata.ui.colortable
Class ColorTableCanvas

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by ucar.unidata.ui.colortable.ColorTableCanvas
All Implemented Interfaces:
KeyListener, MouseListener, MouseMotionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class ColorTableCanvas
extends JPanel
implements MouseMotionListener, MouseListener, KeyListener

This class provides the guts of the color table editor. The actual ColorTableCanvas is a JPanel that draws the color bar in the editor. This class also provides the gui components that are wrapped the canvas itself.

See Also:
Serialized Form

Nested Class Summary
static class ColorTableCanvas.CanvasCommand
          Class CanvasCommand takes a snapshot of the state of the canvas
static class ColorTableCanvas.ColorListCommand
          Class ColorListCommand
static class ColorTableCanvas.ColorTableCommand
          Class ColorTableCommand is used when the CT is changed and we can undo it using this class
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static Cursor normalCursor
          The normal cursor_
static Cursor paintCursor
          _more_
static String PROP_CANCEL
          Name of property for the property event listener when cancel was pressed
static String PROP_CLOSE
          Name of property for the property event listener when window was closed
static String PROP_COLORTABLE
          Name of property for the property event listener when color table has changed
static String PROP_RANGE
          Name of property for the property event listener when range has changed
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ColorTableCanvas()
          Create me
ColorTableCanvas(ColorTableEditor editor, ColorTable table)
          Create me
 
Method Summary
 void addBreakpointAtData()
          Add a new breakpoint, prompting the user at what data value it shoudl be placed
 void addBreakpointAtData(ColorTable.Breakpoint bp)
          Add a new breakpoint the given index.
 void addBreakpointBeginning()
          Add BP at the start
 void addBreakpointEnd()
          Add BP at the end
 void addColor(boolean start, int cnt)
          Add cnt number of color slots
 void addPropertyChangeListener(PropertyChangeListener listener)
          Add the listener
 int boxWidth()
          What is the width of the color box
 void brightAll()
          Set the transparency between the 2 BPs
 void brightLeft()
          Set the transparency to the left of the current BP
 void brightRight()
          Set the transparency to the right of the current BP
 void checkCursor(MouseEvent e)
          set the cursor
 void colorsChanged()
          The colors have changed.
 void debug()
          Debug println
 void doApply()
          Send the table and range changed events
 void doCancel()
          Cancel and send the cancel event
 void doClose()
          Send the close event
 void fill(Color color, ColorTable.Breakpoint from, ColorTable.Breakpoint to)
          Fill with the given color between the 2 BPs.
 void fillAll()
          Fill with the given color between the 2 BPs.
 void fillFromTo(Color color, int lowerIndex, int upperIndex)
          Fill with the given color between the 2 indices.
 void fillLeft()
          Fill to the left of the selected BP
 void fillRight()
          Fill to the right of the selected BP
 Rectangle getColorBox()
          Get the bounding box of the color box
 Rectangle getColorBox(Rectangle bounds)
          Get the bounding box of the color box
 JPanel getContents()
          Get the main GUI contents.
 ColorTable getCurrentColorTable()
          Get the currently edited CT
static Icon getIcon(ColorTable ct)
          Create and return an ImageIcon that represents this color table.
static Icon getIcon(ColorTable ct, int width, int height)
          _more_
static Image getImage(ColorTable ct, int width, int height)
           
 Cursor getPaintCursor()
          Get the paint brush cursor
 boolean imageUpdate(Image img, int flags, int x, int y, int width, int height)
          Image update method
 void init(ColorTable newTable)
          Init me
 void insertBreakpoint(double percent)
          Insert a new BP at percent along the line
 void interpolate(ColorTable.Breakpoint from, ColorTable.Breakpoint to)
          Do a linear interpolation of the colors in the range defined by the given breakpoints.
 void interpolate(int lowerColorIndex, int upperColorIndex, Color lowerColor, Color upperColor)
          Do a linear interpolation between the given colors
 void interpolateAll()
          Interpolate color from end to end
 void interpolateBrightness(ColorTable.Breakpoint from, ColorTable.Breakpoint to)
          Do a linear interpolation of the colors in the range defined by the given breakpoints.
 void interpolateBrightness(int lowerColorIndex, int upperColorIndex, Color lowerColor, Color upperColor)
          Do a linear interpolation of transparency between the given colors
 void interpolateBrightnessAll()
          Interpolate transparency from end to end
 void interpolateBrightnessLeft()
          Interpolate transparency left
 void interpolateBrightnessRight()
          Interpolate transparency right
 void interpolateLeft()
          Interpolate color left
 void interpolateRight()
          Interpolate color right
 void interpolateTrans(ColorTable.Breakpoint from, ColorTable.Breakpoint to)
          Do a linear interpolation of the colors in the range defined by the given breakpoints.
 void interpolateTrans(int lowerColorIndex, int upperColorIndex, Color lowerColor, Color upperColor)
          Do a linear interpolation of transparency between the given colors
 void interpolateTransAll()
          Interpolate transparency from end to end
 void interpolateTransLeft()
          Interpolate transparency left
 void interpolateTransRight()
          Interpolate transparency right
 void invert()
          invert the color table
 boolean isInBox(MouseEvent event)
          Is the mouse in the color box
 boolean isStandAlone()
          Do we have listeners
 void keyPressed(KeyEvent e)
          Catch the key pressed event
 void keyReleased(KeyEvent e)
          Noop
 void keyTyped(KeyEvent e)
          Noop
 void lockUnlockBreakpoint(ColorTable.Breakpoint bp)
          change the lock status on the BP
 void mouseClicked(MouseEvent event)
          Catch the event
 void mouseDragged(MouseEvent event)
          The mouse was dragged
 void mouseEntered(MouseEvent e)
          Noop
 void mouseExited(MouseEvent e)
          Noop
 void mouseMoved(MouseEvent e)
          Noop
 void mousePressed(MouseEvent event)
          Mouse was pressed
 void mouseReleased(MouseEvent event)
          Catch the event
 void newInterpolate(int colorSpace, int lowerColorIndex, int upperColorIndex, Color lowerColor, Color upperColor)
           
 void oldInterpolate(int lowerColorIndex, int upperColorIndex, Color lowerColor, Color upperColor)
           
 void paint(Graphics g)
          Paint
 void paintColors(Graphics g)
          Paint the color box
static void paintColors(Graphics g, Rectangle box, List<Color> colorList, boolean doLines, boolean doCheckerboard, boolean doTransparency, List<Float> scales)
           
static void paintColors(Graphics g, Rectangle box, List<Color> colorList, boolean doLines, boolean doCheckerboard, List<Float> scales)
          Paint the color box
 void paintInner(Graphics g)
          Really paint
 Color percentToColor(double percent)
          Map the percent along the color box to the color
 int percentToColorIndex(double percent)
          Map percent along the color box to the index in the color list
 double percentToValue(double percent)
          Get the value of the point percent along the color box
 int percentToX(double percent)
          Map percent along color box to x location
 void rangeChanged()
          Propagate the range changed event
 boolean reallyInBox(MouseEvent event)
           
 void removeBreakpoint()
          Remove the currently selected BP
 void removeColor(boolean start, int cnt)
          Remove cnt number of color slots
 void repaint()
          Repaint
 void replicate()
          replicate
 void setBrightness(ColorTable.Breakpoint from, ColorTable.Breakpoint to)
          Set the transparency between the 2 BPs
 void setBrightnessFromTo(int lowerIndex, int upperIndex)
          Set the transparency between the 2 indices
 void setColor(Color c)
          Set the color at the current BP
 void setColorTable(ColorTable newTable)
          GOt a new colortable
protected  void setMinMax()
          Set the range from the text fields
 void setName(String name)
          Set the name of the CT
 void setPropagateChanges(boolean v)
          Should we propagate changes
protected  void setRange(double min, double max)
          Set the range
 void setTransparency()
          Set the transparency on the currently selected breakpoint
 void setTransparency(ColorTable.Breakpoint from, ColorTable.Breakpoint to)
          Set the transparency between the 2 BPs
 void setTransparencyFromTo(int lowerIndex, int upperIndex)
          Set the transparency between the 2 indices
 void tableChanged()
          Propagate the table changed event
 void tableChanged(boolean force)
          Propagate the table changed event
 void transAll()
          Set the transparency between the 2 BPs
 void transLeft()
          Set the transparency to the left of the current BP
 void transRight()
          Set the transparency to the right of the current BP
 double xToPercent(int x)
          Map x location to percent along color box
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROP_COLORTABLE

public static final String PROP_COLORTABLE
Name of property for the property event listener when color table has changed

See Also:
Constant Field Values

PROP_RANGE

public static final String PROP_RANGE
Name of property for the property event listener when range has changed

See Also:
Constant Field Values

PROP_CANCEL

public static final String PROP_CANCEL
Name of property for the property event listener when cancel was pressed

See Also:
Constant Field Values

PROP_CLOSE

public static final String PROP_CLOSE
Name of property for the property event listener when window was closed

See Also:
Constant Field Values

normalCursor

public static final Cursor normalCursor
The normal cursor_


paintCursor

public static Cursor paintCursor
_more_

Constructor Detail

ColorTableCanvas

public ColorTableCanvas()
Create me


ColorTableCanvas

public ColorTableCanvas(ColorTableEditor editor,
                        ColorTable table)
Create me

Parameters:
editor - The editor I am part of
table - The color table to edit
Method Detail

init

public void init(ColorTable newTable)
Init me

Parameters:
newTable - The color table to edit

setColorTable

public void setColorTable(ColorTable newTable)
GOt a new colortable

Parameters:
newTable - The new table

getContents

public JPanel getContents()
Get the main GUI contents.

Returns:
The GUI

setTransparency

public void setTransparency()
Set the transparency on the currently selected breakpoint


setName

public void setName(String name)
Set the name of the CT

Overrides:
setName in class Component
Parameters:
name - The name

setMinMax

protected void setMinMax()
Set the range from the text fields


setRange

protected void setRange(double min,
                        double max)
Set the range

Parameters:
min - Range min
max - Range max

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Add the listener

Overrides:
addPropertyChangeListener in class Container
Parameters:
listener - The listener

isStandAlone

public boolean isStandAlone()
Do we have listeners

Returns:
Do we have listeners

getCurrentColorTable

public ColorTable getCurrentColorTable()
Get the currently edited CT

Returns:
The CT

doClose

public void doClose()
Send the close event


doApply

public void doApply()
Send the table and range changed events


doCancel

public void doCancel()
Cancel and send the cancel event


tableChanged

public void tableChanged()
Propagate the table changed event


tableChanged

public void tableChanged(boolean force)
Propagate the table changed event

Parameters:
force - If true then send the change no matter what

rangeChanged

public void rangeChanged()
Propagate the range changed event


setPropagateChanges

public void setPropagateChanges(boolean v)
Should we propagate changes

Parameters:
v - The flag

colorsChanged

public void colorsChanged()
The colors have changed. Repaint and update the GUI.


addColor

public void addColor(boolean start,
                     int cnt)
Add cnt number of color slots

Parameters:
start - At start or end
cnt - How many to add

removeColor

public void removeColor(boolean start,
                        int cnt)
Remove cnt number of color slots

Parameters:
start - At start or end
cnt - How many to remove

keyPressed

public void keyPressed(KeyEvent e)
Catch the key pressed event

Specified by:
keyPressed in interface KeyListener
Parameters:
e - The event

keyReleased

public void keyReleased(KeyEvent e)
Noop

Specified by:
keyReleased in interface KeyListener
Parameters:
e - The event

keyTyped

public void keyTyped(KeyEvent e)
Noop

Specified by:
keyTyped in interface KeyListener
Parameters:
e - The event

mouseMoved

public void mouseMoved(MouseEvent e)
Noop

Specified by:
mouseMoved in interface MouseMotionListener
Parameters:
e - The event

mouseEntered

public void mouseEntered(MouseEvent e)
Noop

Specified by:
mouseEntered in interface MouseListener
Parameters:
e - The event

mouseExited

public void mouseExited(MouseEvent e)
Noop

Specified by:
mouseExited in interface MouseListener
Parameters:
e - The event

getPaintCursor

public Cursor getPaintCursor()
Get the paint brush cursor

Returns:
paint brush cursor

checkCursor

public void checkCursor(MouseEvent e)
set the cursor

Parameters:
e - event

isInBox

public boolean isInBox(MouseEvent event)
Is the mouse in the color box

Parameters:
event - event
Returns:
is in box

reallyInBox

public boolean reallyInBox(MouseEvent event)

mousePressed

public void mousePressed(MouseEvent event)
Mouse was pressed

Specified by:
mousePressed in interface MouseListener
Parameters:
event - The event

mouseDragged

public void mouseDragged(MouseEvent event)
The mouse was dragged

Specified by:
mouseDragged in interface MouseMotionListener
Parameters:
event - The event

mouseReleased

public void mouseReleased(MouseEvent event)
Catch the event

Specified by:
mouseReleased in interface MouseListener
Parameters:
event - The event

mouseClicked

public void mouseClicked(MouseEvent event)
Catch the event

Specified by:
mouseClicked in interface MouseListener
Parameters:
event - The event

addBreakpointAtData

public void addBreakpointAtData()
Add a new breakpoint, prompting the user at what data value it shoudl be placed


addBreakpointAtData

public void addBreakpointAtData(ColorTable.Breakpoint bp)
Add a new breakpoint the given index. If index<0 then prompt the user at what data value it shoudl be placed

Parameters:
bp - the sample breakpoint

insertBreakpoint

public void insertBreakpoint(double percent)
Insert a new BP at percent along the line

Parameters:
percent - Where to insert

debug

public void debug()
Debug println


removeBreakpoint

public void removeBreakpoint()
Remove the currently selected BP


lockUnlockBreakpoint

public void lockUnlockBreakpoint(ColorTable.Breakpoint bp)
change the lock status on the BP

Parameters:
bp - the breakpoint to lock/unlock

addBreakpointBeginning

public void addBreakpointBeginning()
Add BP at the start


addBreakpointEnd

public void addBreakpointEnd()
Add BP at the end


setColor

public void setColor(Color c)
Set the color at the current BP

Parameters:
c - The color

boxWidth

public int boxWidth()
What is the width of the color box

Returns:
Color box width

xToPercent

public double xToPercent(int x)
Map x location to percent along color box

Parameters:
x - X location
Returns:
Percent along color box

percentToX

public int percentToX(double percent)
Map percent along color box to x location

Parameters:
percent - Percent along color box
Returns:
X location

percentToValue

public double percentToValue(double percent)
Get the value of the point percent along the color box

Parameters:
percent - Percent along the color box
Returns:
Value

interpolateAll

public void interpolateAll()
Interpolate color from end to end


interpolateLeft

public void interpolateLeft()
Interpolate color left


interpolateRight

public void interpolateRight()
Interpolate color right


interpolateTransAll

public void interpolateTransAll()
Interpolate transparency from end to end


interpolateTransLeft

public void interpolateTransLeft()
Interpolate transparency left


interpolateTransRight

public void interpolateTransRight()
Interpolate transparency right


interpolateBrightnessAll

public void interpolateBrightnessAll()
Interpolate transparency from end to end


interpolateBrightnessLeft

public void interpolateBrightnessLeft()
Interpolate transparency left


interpolateBrightnessRight

public void interpolateBrightnessRight()
Interpolate transparency right


replicate

public void replicate()
replicate


invert

public void invert()
invert the color table


interpolate

public void interpolate(ColorTable.Breakpoint from,
                        ColorTable.Breakpoint to)
Do a linear interpolation of the colors in the range defined by the given breakpoints.

Parameters:
from - starting breakpoint
to - ending breakpoint

interpolate

public void interpolate(int lowerColorIndex,
                        int upperColorIndex,
                        Color lowerColor,
                        Color upperColor)
Do a linear interpolation between the given colors

Parameters:
lowerColorIndex - Where to start
upperColorIndex - Where to end
lowerColor - The lower color
upperColor - The upper color

newInterpolate

public void newInterpolate(int colorSpace,
                           int lowerColorIndex,
                           int upperColorIndex,
                           Color lowerColor,
                           Color upperColor)

oldInterpolate

public void oldInterpolate(int lowerColorIndex,
                           int upperColorIndex,
                           Color lowerColor,
                           Color upperColor)

interpolateTrans

public void interpolateTrans(ColorTable.Breakpoint from,
                             ColorTable.Breakpoint to)
Do a linear interpolation of the colors in the range defined by the given breakpoints.

Parameters:
from - starting breakpoint
to - ending breakpoint

interpolateTrans

public void interpolateTrans(int lowerColorIndex,
                             int upperColorIndex,
                             Color lowerColor,
                             Color upperColor)
Do a linear interpolation of transparency between the given colors

Parameters:
lowerColorIndex - Where to start
upperColorIndex - Where to end
lowerColor - The lower color
upperColor - The upper color

interpolateBrightness

public void interpolateBrightness(ColorTable.Breakpoint from,
                                  ColorTable.Breakpoint to)
Do a linear interpolation of the colors in the range defined by the given breakpoints.

Parameters:
from - starting breakpoint
to - ending breakpoint

interpolateBrightness

public void interpolateBrightness(int lowerColorIndex,
                                  int upperColorIndex,
                                  Color lowerColor,
                                  Color upperColor)
Do a linear interpolation of transparency between the given colors

Parameters:
lowerColorIndex - Where to start
upperColorIndex - Where to end
lowerColor - The lower color
upperColor - The upper color

fillLeft

public void fillLeft()
Fill to the left of the selected BP


fillRight

public void fillRight()
Fill to the right of the selected BP


fill

public void fill(Color color,
                 ColorTable.Breakpoint from,
                 ColorTable.Breakpoint to)
Fill with the given color between the 2 BPs.

Parameters:
color - The fill color
from - The lower end
to - The upper end

fillAll

public void fillAll()
Fill with the given color between the 2 BPs.


fillFromTo

public void fillFromTo(Color color,
                       int lowerIndex,
                       int upperIndex)
Fill with the given color between the 2 indices.

Parameters:
color - The fill color
lowerIndex - The lower index
upperIndex - The upper index

transLeft

public void transLeft()
Set the transparency to the left of the current BP


transRight

public void transRight()
Set the transparency to the right of the current BP


transAll

public void transAll()
Set the transparency between the 2 BPs


setTransparency

public void setTransparency(ColorTable.Breakpoint from,
                            ColorTable.Breakpoint to)
Set the transparency between the 2 BPs

Parameters:
from - The lower BP
to - The upper BP

setTransparencyFromTo

public void setTransparencyFromTo(int lowerIndex,
                                  int upperIndex)
Set the transparency between the 2 indices

Parameters:
lowerIndex - The lower index
upperIndex - The upper index

brightLeft

public void brightLeft()
Set the transparency to the left of the current BP


brightRight

public void brightRight()
Set the transparency to the right of the current BP


setBrightness

public void setBrightness(ColorTable.Breakpoint from,
                          ColorTable.Breakpoint to)
Set the transparency between the 2 BPs

Parameters:
from - The lower BP
to - The upper BP

brightAll

public void brightAll()
Set the transparency between the 2 BPs


setBrightnessFromTo

public void setBrightnessFromTo(int lowerIndex,
                                int upperIndex)
Set the transparency between the 2 indices

Parameters:
lowerIndex - The lower index
upperIndex - The upper index

getColorBox

public Rectangle getColorBox()
Get the bounding box of the color box

Returns:
The color box

getColorBox

public Rectangle getColorBox(Rectangle bounds)
Get the bounding box of the color box

Parameters:
bounds - The bounds around the color box
Returns:
The color box

percentToColorIndex

public int percentToColorIndex(double percent)
Map percent along the color box to the index in the color list

Parameters:
percent - Percent along the color box
Returns:
Color index

percentToColor

public Color percentToColor(double percent)
Map the percent along the color box to the color

Parameters:
percent - Along color box
Returns:
The color

paintColors

public void paintColors(Graphics g)
Paint the color box

Parameters:
g - The graphics

paintColors

public static void paintColors(Graphics g,
                               Rectangle box,
                               List<Color> colorList,
                               boolean doLines,
                               boolean doCheckerboard,
                               List<Float> scales)
Paint the color box

Parameters:
g - The graphics
box - _more_
colorList - _more_
doLines - _more_
doCheckerboard - _more_
scales - _more_

paintColors

public static void paintColors(Graphics g,
                               Rectangle box,
                               List<Color> colorList,
                               boolean doLines,
                               boolean doCheckerboard,
                               boolean doTransparency,
                               List<Float> scales)

repaint

public void repaint()
Repaint

Overrides:
repaint in class Component

paint

public void paint(Graphics g)
Paint

Overrides:
paint in class JComponent
Parameters:
g - The graphics

paintInner

public void paintInner(Graphics g)
Really paint

Parameters:
g - The graphics

imageUpdate

public boolean imageUpdate(Image img,
                           int flags,
                           int x,
                           int y,
                           int width,
                           int height)
Image update method

Specified by:
imageUpdate in interface ImageObserver
Overrides:
imageUpdate in class Component
Parameters:
img - the image
flags - flags
x - x position
y - y position
width - width
height - height
Returns:
true if successful

getIcon

public static Icon getIcon(ColorTable ct)
Create and return an ImageIcon that represents this color table. If there were any errors then return null.

Parameters:
ct - The CT
Returns:
The icon

getIcon

public static Icon getIcon(ColorTable ct,
                           int width,
                           int height)
_more_

Parameters:
ct - _more_
width - _more_
height - _more_
Returns:
_more_

getImage

public static Image getImage(ColorTable ct,
                             int width,
                             int height)