Java 6 SE Platform
6.0
Home

com.woven_media.colorsafe
Class ColorModelView

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by com.woven_media.colorsafe.ColorModelView
All Implemented Interfaces:
IPalette, java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public class ColorModelView
extends javax.swing.JFrame
implements java.awt.event.MouseListener, IPalette

ColorModelView class extends javax.swing.JFrame and handles creation of the various color palettes and palette views for the ColorSafe GUI.

Since:
1.0
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  int b
           
private  java.awt.Color c
           
private  Controller controller
           
private  java.awt.Container cp
           
private static int ctr
           
private static java.lang.String errmsg
           
private static javax.swing.JFrame frame
           
private  int g
           
private  java.awt.GridBagLayout gb
           
private  java.awt.GridBagConstraints gbc
           
private  java.lang.String[] hexColors
           
private  java.awt.Font labelFont
           
private  java.lang.String[] labels
           
private  javax.swing.JLabel lblHex
           
private  javax.swing.JLabel lblRGB
           
private  javax.swing.JPanel lowerPanel
           
private  java.lang.String[] namedColors
           
private static int numColors
           
private static int palette
           
private  javax.swing.JPanel[] panels
           
private  PaletteInfoPanel pip
           
private  int r
           
private static java.util.ResourceBundle rb
           
private  int[][] rgbColors
           
private  javax.swing.JPanel swatch
           
private  java.lang.String title
           
private  javax.swing.JPanel upperPanel
           
private  java.net.URL url
           
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface com.woven_media.colorsafe.IPalette
BG_VAL, GRAYSCALE_NUM_COLORS, GRAYSCALE_PALETTE, GRAYSCALE_TITLE, HEX_VAL, NAMED_COLORS_PALETTE, NAMED_COLORS_TITLE, NAMED_NUM_COLORS, NETSCAPE_NUM_COLORS, NETSCAPE_PALETTE, NETSCAPE_TITLE, RGB_VAL, WIN_GRAYS_NUM_COLORS, WIN_NUM_COLORS, WINDOWS_GRAYS_PALETTE, WINDOWS_GRAYS_TITLE, WINDOWS_PALETTE, WINDOWS_TITLE, X11_NUM_COLORS, X11_PALETTE, X11_TITLE
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ColorModelView(Controller c, javax.swing.JFrame f, java.lang.String paletteTitle, int paletteType)
          ColorModelView constructor handles initialization and sets the palette type.
 
Method Summary
 void colorUI()
          Builds the panel matrix UI.
 void getColorMatrix()
          Determines which palette to build based on constants defined in IPalette interface and the palette type enum passed to the constructor for this instance.
 int getNumColors()
          Returns the number of colors for this palette.
 int getPalette()
          Returns the palette type.
 void grayColorMatrix()
          Builds either the Windows 256 Grays Palette or standard Grayscale Palette based on the value of the this.getPalette method.
private  void init()
          Handles initialization and the PaletteInfoPanel instantiation.
 void mouseClicked(java.awt.event.MouseEvent e)
          Empty method signature required by the java.awt.event.MouseListener interface.
 void mouseEntered(java.awt.event.MouseEvent e)
          Handles mouse events entering individual color panels.
 void mouseExited(java.awt.event.MouseEvent e)
          Reverts back to default cursor when mouse exits a color panel.
 void mousePressed(java.awt.event.MouseEvent e)
          Empty method signature required by the java.awt.event.MouseListener interface.
 void mouseReleased(java.awt.event.MouseEvent e)
          Sets the java.awt.Color object by grabbing the client property "RGBColor" from the javax.swing.JComponent.getClientProperty method for the selected color panel.
 void namedColorMatrix(int type)
          Builds the NamedColors palette.
 void safeColorMatrix()
          Builds either the Windows System Palette or Netscape Palette based on the value of this.getPalette method.
 void setNumColors(int num)
          Sets the number of colors for this palette.
 void setPalette(int palette)
          Sets the palette type member.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

ctr

private static int ctr

palette

private static int palette

numColors

private static int numColors

frame

private static javax.swing.JFrame frame

hexColors

private java.lang.String[] hexColors

namedColors

private java.lang.String[] namedColors

rgbColors

private int[][] rgbColors

panels

private javax.swing.JPanel[] panels

r

private int r

g

private int g

b

private int b

cp

private java.awt.Container cp

labels

private java.lang.String[] labels

gb

private java.awt.GridBagLayout gb

gbc

private java.awt.GridBagConstraints gbc

upperPanel

private javax.swing.JPanel upperPanel

lowerPanel

private javax.swing.JPanel lowerPanel

swatch

private javax.swing.JPanel swatch

lblRGB

private javax.swing.JLabel lblRGB

lblHex

private javax.swing.JLabel lblHex

labelFont

private java.awt.Font labelFont

pip

private PaletteInfoPanel pip

c

private java.awt.Color c

title

private java.lang.String title

controller

private Controller controller

url

private java.net.URL url

rb

private static java.util.ResourceBundle rb

errmsg

private static java.lang.String errmsg
Constructor Detail

ColorModelView

public ColorModelView(Controller c,
                      javax.swing.JFrame f,
                      java.lang.String paletteTitle,
                      int paletteType)
ColorModelView constructor handles initialization and sets the palette type.

Parameters:
c - reference to the Controller object.
f - reference to the parent frame.
paletteTitle - title of the selected palette.
paletteType - palette type of the current selection.
Since:
1.0
Method Detail

init

private void init()
Handles initialization and the PaletteInfoPanel instantiation.

Since:
1.0

colorUI

public void colorUI()
Builds the panel matrix UI.

Since:
1.0

getColorMatrix

public void getColorMatrix()
Determines which palette to build based on constants defined in IPalette interface and the palette type enum passed to the constructor for this instance.

Since:
1.0

safeColorMatrix

public void safeColorMatrix()
Builds either the Windows System Palette or Netscape Palette based on the value of this.getPalette method.

Since:
1.0

grayColorMatrix

public void grayColorMatrix()
Builds either the Windows 256 Grays Palette or standard Grayscale Palette based on the value of the this.getPalette method.

Since:
1.0

namedColorMatrix

public void namedColorMatrix(int type)
Builds the NamedColors palette. Calls NamedColors class.

Parameters:
type - indicates Windows-named color palette or standards-compliant X11 color palette.
Since:
1.0

setNumColors

public void setNumColors(int num)
Sets the number of colors for this palette.

Parameters:
num - int value representing the number of colors the current palette.
Since:
1.0

getNumColors

public int getNumColors()
Returns the number of colors for this palette.

Returns:
numColors int value representing to number of colors in current palette.
Since:
1.0

setPalette

public void setPalette(int palette)
Sets the palette type member.

Parameters:
palette - int value representing the palette type.
Since:
1.0

getPalette

public int getPalette()
Returns the palette type.

Returns:
palette an int value representing the palette type.
Since:
1.0

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Handles mouse events entering individual color panels. Grabs the client properties for this color panel and sets the PaletteInfoPanel#selectedObject method.

Specified by:
mouseEntered in interface java.awt.event.MouseListener
Parameters:
e - java.awt.event.MouseEvent parameter.
Since:
1.0

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Sets the java.awt.Color object by grabbing the client property "RGBColor" from the javax.swing.JComponent.getClientProperty method for the selected color panel. Sets the current color and disposes of the palette frame.

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Parameters:
e - java.awt.event.MouseEvent.
Since:
1.0
See Also:
JComponent.getClientProperty(java.lang.Object)

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Reverts back to default cursor when mouse exits a color panel.

Specified by:
mouseExited in interface java.awt.event.MouseListener
Parameters:
e - java.awt.event.MouseEvent required parameter.

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Empty method signature required by the java.awt.event.MouseListener interface.

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Parameters:
e - java.awt.event.MouseEvent required parameter.

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Empty method signature required by the java.awt.event.MouseListener interface.

Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
e - java.awt.event.MouseEvent required parameter.

Java 6 SE Platform
6.0
Home

JavaDoc API documentation written, prepared and compiled by Brent Allen Parrish, woven-media.com, 20 SEPT 2009