public class GradientSlider extends MultiThumbSlider
GradientSlider can contain any number of thumbs. The
slider itself represents a range of values from zero to one, so the thumbs
must always be within this range. Each thumb maps to a specific Color.
There are some specific properties you can set to customize the look-and-feel
of this slider in the default GradientSliderUI class.
The UI for each slider is loaded from the UIManager property: "GradientSliderUI". By default this is "org.gephi.ui.components.gradientslider.GradientSliderUI".
| Modifier and Type | Class and Description |
|---|---|
(package private) class |
GradientSlider.AbstractPopup |
(package private) class |
GradientSlider.ColorPickerPopup |
(package private) class |
GradientSlider.SelectThumbRunnable |
JComponent.AccessibleJComponentContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
(package private) JPopupMenu |
popup
The popup for contextual menus.
|
private static long |
serialVersionUID |
ADJUST_PROPERTY, adjusting, autoAdd, blocked, changeListeners, HORIZONTAL, inverted, INVERTED_PROPERTY, orientation, ORIENTATION_PROPERTY, PAINT_TICKS_PROPERTY, paintTicks, SELECTED_THUMB_PROPERTY, thumbPositions, values, VALUES_PROPERTY, VERTICALlistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
GradientSlider()
Create a horizontal
GradientSlider that
represents a gradient from white to black. |
GradientSlider(int orientation)
Create a
GradientSlider that represents a
gradient form white to black. |
GradientSlider(int orientation,
float[] thumbPositions,
Color[] values)
Create a new
GradientSlider. |
| Modifier and Type | Method and Description |
|---|---|
private JPopupMenu |
createPopup() |
boolean |
doDoubleClick(int x,
int y)
This invokes a
ColorPicker dialog to edit
the thumb at the selected index. |
boolean |
doPopup(int x,
int y)
This shows a mini ColorPicker panel to let the user
change the selected color.
|
Color[] |
getColors()
This is identical to
getValues(),
except the return value is an array of Colors. |
private Frame |
getFrame() |
Object |
getValue(float pos)
Returns the Color at the specified position.
|
private boolean |
showColorPicker() |
private void |
showJColorChooser()
TODO: If developers don't want to bundle the ColorPicker with their programs,
they can use this method instead of
showColorPicker(). |
private static Color |
tween(Color c1,
Color c2,
float p) |
void |
updateUI() |
addChangeListener, addThumb, fireChangeListeners, getOrientation, getSelectedThumb, getSelectedThumb, getThumbCount, getThumbPositions, getValues, isAutoAdding, isBlocked, isInverted, isPaintTicks, isValueAdjusting, removeChangeListener, removeThumb, setAutoAdding, setBlocked, setInverted, setOrientation, setPaintTicks, setSelectedThumb, setValueIsAdjusting, setValues, transferFocus, transferFocusBackwardaddAncestorListener, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, updateadd, 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, validateTreeaction, 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, getAccessibleContext, 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, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocusUpCycleprivate static final long serialVersionUID
JPopupMenu popup
public GradientSlider()
GradientSlider that
represents a gradient from white to black.public GradientSlider(int orientation)
GradientSlider that represents a
gradient form white to black.orientation - HORIZONTAL or VERTICALpublic GradientSlider(int orientation,
float[] thumbPositions,
Color[] values)
GradientSlider.orientation - HORIZONTAL or VERTICALthumbPositions - the initial positions of each thumbvalues - the initial colors at each positionIllegalArgumentException - if the number of elements in
thumbPositions does not equal the number of elements
in values.public Object getValue(float pos)
getValue in class MultiThumbSliderpos - a position between zero and onepublic Color[] getColors()
getValues(),
except the return value is an array of Colors.public boolean doDoubleClick(int x,
int y)
ColorPicker dialog to edit
the thumb at the selected index.doDoubleClick in class MultiThumbSliderx - the x-value of the mouse click locationy - the y-value of the mouse click locationprivate JPopupMenu createPopup()
public boolean doPopup(int x,
int y)
doPopup in class MultiThumbSliderx - the x-value of the mouse click locationy - the y-value of the mouse click locationprivate Frame getFrame()
private boolean showColorPicker()
private void showJColorChooser()
showColorPicker().public void updateUI()
updateUI in class JComponentCopyright © 2007–2017 Gephi Consortium. All rights reserved.