Package ca.cgjennings.apps.arkham
Class ColourDialog
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Dialog
-
- javax.swing.JDialog
-
- ca.cgjennings.apps.arkham.ColourDialog
-
- All Implemented Interfaces:
Tintable
,AgnosticDialog
,java.awt.event.ActionListener
,java.awt.event.FocusListener
,java.awt.event.WindowListener
,java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,java.util.EventListener
,javax.accessibility.Accessible
,javax.swing.event.ChangeListener
,javax.swing.RootPaneContainer
,javax.swing.WindowConstants
public class ColourDialog extends javax.swing.JDialog implements AgnosticDialog, Tintable, java.awt.event.ActionListener, java.awt.event.FocusListener, javax.swing.event.ChangeListener, java.awt.event.WindowListener
A colour selection dialog consistent with the tint selector (HSBPanel
).- Author:
- Chris Jennings
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ColourDialog.ColourButton
A button whose background color represents a selected or selectable colour.-
Nested classes/interfaces inherited from class javax.swing.JDialog
javax.swing.JDialog.AccessibleJDialog
-
Nested classes/interfaces inherited from class java.awt.Dialog
java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType
-
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
-
-
Field Summary
-
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
-
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
-
Constructor Summary
Constructors Constructor Description ColourDialog(java.awt.Frame parent)
ColourDialog(java.awt.Frame parent, boolean setOpacity)
Creates new form ColourDialog
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent evt)
void
focusGained(java.awt.event.FocusEvent evt)
void
focusLost(java.awt.event.FocusEvent evt)
float
getOpacity()
java.awt.Color
getSelectedColor()
Returns the colour selected by the user using the dialog, ornull
.static ColourDialog
getSharedDialog()
float[]
getTint()
void
handleCancelAction(java.awt.event.ActionEvent e)
Performs whatever action is required when the Cancel button is pressed.void
handleOKAction(java.awt.event.ActionEvent e)
Performs whatever action is required when the OK button is pressed.void
setOpacity(float opacity)
void
setSelectedColor(java.awt.Color selection)
Sets the currently selected colour in the dialog.void
setTint(float hueShift, float saturation, float brightness)
void
setVisible(boolean visible)
void
stateChanged(javax.swing.event.ChangeEvent evt)
void
windowActivated(java.awt.event.WindowEvent evt)
void
windowClosed(java.awt.event.WindowEvent evt)
void
windowClosing(java.awt.event.WindowEvent evt)
void
windowDeactivated(java.awt.event.WindowEvent evt)
void
windowDeiconified(java.awt.event.WindowEvent evt)
void
windowIconified(java.awt.event.WindowEvent evt)
void
windowOpened(java.awt.event.WindowEvent evt)
-
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
-
Methods inherited from class java.awt.Dialog
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setResizable, setShape, setTitle, setUndecorated, show, toBack
-
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, 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, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, 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, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Method Detail
-
getSharedDialog
public static ColourDialog getSharedDialog()
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent evt)
- Specified by:
actionPerformed
in interfacejava.awt.event.ActionListener
-
focusGained
public void focusGained(java.awt.event.FocusEvent evt)
- Specified by:
focusGained
in interfacejava.awt.event.FocusListener
-
focusLost
public void focusLost(java.awt.event.FocusEvent evt)
- Specified by:
focusLost
in interfacejava.awt.event.FocusListener
-
windowActivated
public void windowActivated(java.awt.event.WindowEvent evt)
- Specified by:
windowActivated
in interfacejava.awt.event.WindowListener
-
windowClosed
public void windowClosed(java.awt.event.WindowEvent evt)
- Specified by:
windowClosed
in interfacejava.awt.event.WindowListener
-
windowClosing
public void windowClosing(java.awt.event.WindowEvent evt)
- Specified by:
windowClosing
in interfacejava.awt.event.WindowListener
-
windowDeactivated
public void windowDeactivated(java.awt.event.WindowEvent evt)
- Specified by:
windowDeactivated
in interfacejava.awt.event.WindowListener
-
windowDeiconified
public void windowDeiconified(java.awt.event.WindowEvent evt)
- Specified by:
windowDeiconified
in interfacejava.awt.event.WindowListener
-
windowIconified
public void windowIconified(java.awt.event.WindowEvent evt)
- Specified by:
windowIconified
in interfacejava.awt.event.WindowListener
-
windowOpened
public void windowOpened(java.awt.event.WindowEvent evt)
- Specified by:
windowOpened
in interfacejava.awt.event.WindowListener
-
stateChanged
public void stateChanged(javax.swing.event.ChangeEvent evt)
- Specified by:
stateChanged
in interfacejavax.swing.event.ChangeListener
-
setOpacity
public void setOpacity(float opacity)
- Overrides:
setOpacity
in classjava.awt.Dialog
-
getOpacity
public float getOpacity()
- Overrides:
getOpacity
in classjava.awt.Window
-
handleOKAction
public void handleOKAction(java.awt.event.ActionEvent e)
Description copied from interface:AgnosticDialog
Performs whatever action is required when the OK button is pressed. Called when the (possibly swapped) OK button generates an ActionEvent.- Specified by:
handleOKAction
in interfaceAgnosticDialog
- Parameters:
e
- theActionEvent
generated by the button
-
handleCancelAction
public void handleCancelAction(java.awt.event.ActionEvent e)
Description copied from interface:AgnosticDialog
Performs whatever action is required when the Cancel button is pressed. Called when the (possibly swapped) OK button generates an ActionEvent.- Specified by:
handleCancelAction
in interfaceAgnosticDialog
- Parameters:
e
- theActionEvent
generated by the button
-
setVisible
public void setVisible(boolean visible)
- Overrides:
setVisible
in classjava.awt.Dialog
-
setTint
public void setTint(float hueShift, float saturation, float brightness)
-
getSelectedColor
public java.awt.Color getSelectedColor()
Returns the colour selected by the user using the dialog, ornull
.- Returns:
- the selected colour
-
setSelectedColor
public void setSelectedColor(java.awt.Color selection)
Sets the currently selected colour in the dialog.- Parameters:
selection
- the colour to select
-
-