Package mgui.interfaces.maps
Class ContinuousColourBar
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
mgui.interfaces.InterfacePanel
mgui.interfaces.maps.ContinuousColourBar
- All Implemented Interfaces:
java.awt.event.ComponentListener,java.awt.event.KeyListener,java.awt.event.MouseListener,java.awt.event.MouseMotionListener,java.awt.image.ImageObserver,java.awt.MenuContainer,java.io.Serializable,java.util.EventListener,javax.accessibility.Accessible,AttributeListener,AttributeObject,DisplayListener,InterfaceObject,CategoryObject,PopupMenuObject,NamedObject,ShapeListener,TreeObject,CleanableObject,IconObject
public class ContinuousColourBar extends InterfacePanel implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.KeyListener
Component displays a continuous colour map as a horizontal bar portraying
the colour gradient between anchors. Displays the anchors themselves as solid
vertical lines
- Author:
- Andrew Reid
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainerNested 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
Fields Modifier and Type Field Description protected java.util.ArrayList<java.awt.event.ActionListener>actionListenersprotected java.awt.image.BufferedImagebarintdecimalsjava.lang.StringdivFontdoubledivSizedoublefontScaleprotected booleanisDraggingprotected java.awt.Fontlabel_fontdoublelineWeightScaleContinuousColourMapmapdoublemaxdoubleminintnoDivisionsprotected java.awt.BasicStrokenormalLineintpaddingintselectedAnchorprotected java.awt.BasicStrokeselectedLinebooleanshowAnchorsbooleanshowDivisionsprotected booleanupdateBarFields inherited from class mgui.interfaces.InterfacePanel
attributes, displayListeners, isDestroyed, last_click_point, statusBar, tree_nodes, treeNode, typeFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
Constructors Constructor Description ContinuousColourBar()ContinuousColourBar(ContinuousColourMap cm) -
Method Summary
Modifier and Type Method Description voidaddActionListener(java.awt.event.ActionListener l)java.lang.Objectclone()protected voiddrawAnchorLeft(java.awt.Graphics2D g2, int pos, int width, int height, boolean selected)protected voiddrawAnchorUp(java.awt.Graphics2D g2, int pos, int width, int height, boolean selected)protected voidfireActionListeners()protected java.awt.image.BufferedImagegetColourBarImage(int x, int y)InterfacePopupMenugetPopupMenu()Produces and returns a popup menu for this object.ContinuousColourMap.AnchorgetSelectedAnchor()voidhandlePopupEvent(java.awt.event.ActionEvent e)Handles an event on this object's popup menu.protected voidinit()voidkeyPressed(java.awt.event.KeyEvent arg0)voidkeyReleased(java.awt.event.KeyEvent arg0)voidkeyTyped(java.awt.event.KeyEvent e)voidmouseClicked(java.awt.event.MouseEvent e)voidmouseDragged(java.awt.event.MouseEvent e)voidmouseEntered(java.awt.event.MouseEvent arg0)voidmouseExited(java.awt.event.MouseEvent arg0)voidmouseMoved(java.awt.event.MouseEvent e)voidmousePressed(java.awt.event.MouseEvent e)voidmouseReleased(java.awt.event.MouseEvent e)protected voidpaintComponent(java.awt.Graphics g)voidremoveActionListener(java.awt.event.ActionListener l)voidremoveAnchor(int anchor)voidselectAnchor(int anchor)voidsetMap(ContinuousColourMap m)voidupdate()voidwriteToImage(java.io.File file)Writes this colour bar to an image file.voidwriteToImage(java.io.File file, int width, int height)Writes this colour bar to an image file.Methods inherited from class mgui.interfaces.InterfacePanel
_init, addDisplayListener, attributeUpdated, clean, cleanUpPanel, collapseAllCategories, collapseCategory, collapseOtherCategories, componentHidden, componentMoved, componentResized, componentShown, destroy, expandAllCategories, expandCategory, fireDisplayListeners, getAttribute, getAttributes, getAttributeValue, getLocalAttributes, getObjectIcon, getPopupMenu, getSource, getTitle, getTreeLabel, getType, isDestroyed, issueTreeNode, removeDisplayListener, setAttribute, setAttributes, setSource, setStatusBar, setTreeNode, setType, shapeUpdated, showPanel, showPopupMenu, updateDisplay, updateDisplays, updateFromDialog, updateTreeNodesMethods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, 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, updateMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, 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, transferFocusDownCycle, validate, validateTreeMethods 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, 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, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface mgui.interfaces.NamedObject
getName, setName
-
Field Details
-
map
-
selectedAnchor
public int selectedAnchor -
updateBar
protected boolean updateBar -
bar
protected java.awt.image.BufferedImage bar -
selectedLine
protected java.awt.BasicStroke selectedLine -
normalLine
protected java.awt.BasicStroke normalLine -
actionListeners
protected java.util.ArrayList<java.awt.event.ActionListener> actionListeners -
isDragging
protected boolean isDragging -
showAnchors
public boolean showAnchors -
showDivisions
public boolean showDivisions -
noDivisions
public int noDivisions -
divSize
public double divSize -
max
public double max -
min
public double min -
decimals
public int decimals -
divFont
public java.lang.String divFont -
fontScale
public double fontScale -
lineWeightScale
public double lineWeightScale -
padding
public int padding -
label_font
protected java.awt.Font label_font
-
-
Constructor Details
-
ContinuousColourBar
public ContinuousColourBar() -
ContinuousColourBar
-
-
Method Details
-
init
protected void init()- Specified by:
initin classInterfacePanel
-
clone
public java.lang.Object clone()- Overrides:
clonein classjava.lang.Object
-
paintComponent
protected void paintComponent(java.awt.Graphics g)- Overrides:
paintComponentin classjavax.swing.JComponent
-
drawAnchorUp
protected void drawAnchorUp(java.awt.Graphics2D g2, int pos, int width, int height, boolean selected) -
drawAnchorLeft
protected void drawAnchorLeft(java.awt.Graphics2D g2, int pos, int width, int height, boolean selected) -
getColourBarImage
protected java.awt.image.BufferedImage getColourBarImage(int x, int y) -
setMap
-
getSelectedAnchor
-
addActionListener
public void addActionListener(java.awt.event.ActionListener l) -
removeActionListener
public void removeActionListener(java.awt.event.ActionListener l) -
fireActionListeners
protected void fireActionListeners() -
selectAnchor
public void selectAnchor(int anchor) -
removeAnchor
public void removeAnchor(int anchor) -
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent e)- Specified by:
mouseClickedin interfacejava.awt.event.MouseListener- Overrides:
mouseClickedin classInterfacePanel
-
update
public void update() -
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent arg0)- Specified by:
mouseEnteredin interfacejava.awt.event.MouseListener- Overrides:
mouseEnteredin classInterfacePanel
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent arg0)- Specified by:
mouseExitedin interfacejava.awt.event.MouseListener- Overrides:
mouseExitedin classInterfacePanel
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)- Specified by:
mousePressedin interfacejava.awt.event.MouseListener- Overrides:
mousePressedin classInterfacePanel
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)- Specified by:
mouseReleasedin interfacejava.awt.event.MouseListener- Overrides:
mouseReleasedin classInterfacePanel
-
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)- Specified by:
mouseDraggedin interfacejava.awt.event.MouseMotionListener- Overrides:
mouseDraggedin classInterfacePanel
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)- Specified by:
mouseMovedin interfacejava.awt.event.MouseMotionListener- Overrides:
mouseMovedin classInterfacePanel
-
keyPressed
public void keyPressed(java.awt.event.KeyEvent arg0)- Specified by:
keyPressedin interfacejava.awt.event.KeyListener- Overrides:
keyPressedin classInterfacePanel
-
keyReleased
public void keyReleased(java.awt.event.KeyEvent arg0)- Specified by:
keyReleasedin interfacejava.awt.event.KeyListener- Overrides:
keyReleasedin classInterfacePanel
-
keyTyped
public void keyTyped(java.awt.event.KeyEvent e)- Specified by:
keyTypedin interfacejava.awt.event.KeyListener- Overrides:
keyTypedin classInterfacePanel
-
getPopupMenu
Description copied from interface:PopupMenuObjectProduces and returns a popup menu for this object.- Specified by:
getPopupMenuin interfacePopupMenuObject- Overrides:
getPopupMenuin classInterfacePanel- Returns:
-
handlePopupEvent
public void handlePopupEvent(java.awt.event.ActionEvent e)Description copied from interface:PopupMenuObjectHandles an event on this object's popup menu.- Specified by:
handlePopupEventin interfacePopupMenuObject- Overrides:
handlePopupEventin classInterfacePanel
-
writeToImage
public void writeToImage(java.io.File file) throws java.io.IOExceptionWrites this colour bar to an image file.- Parameters:
file-- Throws:
java.io.IOException
-
writeToImage
public void writeToImage(java.io.File file, int width, int height) throws java.io.IOExceptionWrites this colour bar to an image file.- Parameters:
file-- Throws:
java.io.IOException
-