- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- javax.swing.colorchooser.AbstractColorChooserPanel
-
- 实现的所有接口
-
ImageObserver
,MenuContainer
,Serializable
,Accessible
public abstract class AbstractColorChooserPanelextends JPanel
这是颜色选择器的抽象超类。 如果要将新的颜色选择器面板添加到JColorChooser
,请为JColorChooser
子类。警告:此类的序列化对象与以后的Swing版本不兼容。 当前的序列化支持适用于运行相同版本Swing的应用程序之间的短期存储或RMI。 从1.4开始,
java.beans
软件包中添加了对所有JavaBeansjava.beans
长期存储的支持。 请参阅XMLEncoder
。- 另请参见:
- Serialized Form
-
-
嵌套类汇总
-
嵌套类/接口声明在类 javax.swing.JPanel
JPanel.AccessibleJPanel
-
嵌套类/接口声明在类 javax.swing.JComponent
JComponent.AccessibleJComponent
-
嵌套类/接口声明在类 java.awt.Container
Container.AccessibleAWTContainer
-
-
字段汇总
字段 变量和类型 字段 描述 static String
TRANSPARENCY_ENABLED_PROPERTY
标识可以选择颜色(alpha值)的透明度-
声明的属性在类 javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
声明的属性在类 java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields declared in interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
-
构造方法摘要
构造方法 构造器 描述 AbstractColorChooserPanel()
-
方法摘要
所有方法 实例方法 抽象方法 具体的方法 变量和类型 方法 描述 protected abstract void
buildChooser()
构建一个新的选择器面板。protected Color
getColorFromModel()
返回当前选定的颜色。ColorSelectionModel
getColorSelectionModel()
返回选择器面板正在编辑的模型。int
getDisplayedMnemonicIndex()
提供关于getDisplayName
中应该在视觉上标识为助记符的字符索引的外观的提示。abstract String
getDisplayName()
返回包含面板显示名称的字符串。abstract Icon
getLargeDisplayIcon()
返回面板的大显示图标。int
getMnemonic()
提供有关KeyEvent.VK
常量的外观的提示,该常量可用作访问面板的助记符。abstract Icon
getSmallDisplayIcon()
返回面板的小显示图标。void
installChooserPanel(JColorChooser enclosingChooser)
将面板添加到选择器时调用。boolean
isColorTransparencySelectionEnabled()
获取颜色选择器面板是否允许选择颜色的透明度(alpha值)。void
paint(Graphics g)
绘制面板。void
setColorTransparencySelectionEnabled(boolean b)
设置颜色选择器面板是否允许选择颜色的透明度(alpha值)。void
uninstallChooserPanel(JColorChooser enclosingChooser)
从选择器中删除面板时调用。abstract void
updateChooser()
模型状态更改时自动调用。-
声明方法的类 javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
声明方法的类 javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, 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, isPaintingOrigin, 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
-
声明方法的类 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, validateTree
-
声明方法的类 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, 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, hide, 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, transferFocusUpCycle
-
-
-
-
方法详细信息
-
updateChooser
public abstract void updateChooser()
模型状态更改时自动调用。 它也被installChooserPanel
调用,允许您设置选择器的初始状态。 重写此方法以更新您的ChooserPanel
。
-
buildChooser
protected abstract void buildChooser()
构建一个新的选择器面板。
-
getDisplayName
public abstract String getDisplayName()
返回包含面板显示名称的字符串。- 结果
- 显示面板的名称
-
getMnemonic
public int getMnemonic()
提供有关KeyEvent.VK
常量的外观的提示,该常量可用作访问面板的助记符。 返回值<= 0表示没有助记符。这里的返回值是一个提示,它最终取决于以某种有意义的方式兑现返回值的外观。
此实现返回0,表示
AbstractColorChooserPanel
不支持助记符,希望助记符的子类需要覆盖它。- 结果
- KeyEvent.VK常量识别助记符; <= 0表示没有助记符
- 从以下版本开始:
- 1.4
- 另请参见:
-
getDisplayedMnemonicIndex()
-
getDisplayedMnemonicIndex
public int getDisplayedMnemonicIndex()
提供有关getDisplayName
中字符索引的外观的提示,该索引应在视觉上标识为助记符。 如果getMnemonic
返回的值> 0,则外观应仅使用此getMnemonic
。这里的返回值是一个提示,它最终取决于以某种有意义的方式兑现返回值的外观。 例如,外观可能希望在
AbstractColorChooserPanel
中呈现每个JTabbedPane
,并进一步使用此返回值为getDisplayName
的字符加下划线。此实现返回-1,表示
AbstractColorChooserPanel
不支持助记符,希望助记符的子类需要覆盖它。- 结果
- 用于呈现助记符的字符索引; -1为此面板提供无可视标识符。
- 从以下版本开始:
- 1.4
- 另请参见:
-
getMnemonic()
-
getSmallDisplayIcon
public abstract Icon getSmallDisplayIcon()
返回面板的小显示图标。- 结果
- 小显示图标
-
getLargeDisplayIcon
public abstract Icon getLargeDisplayIcon()
返回面板的大显示图标。- 结果
- 大显示图标
-
installChooserPanel
public void installChooserPanel(JColorChooser enclosingChooser)
将面板添加到选择器时调用。 如果您覆盖此,请务必致电super
。- 参数
-
enclosingChooser
- 要添加面板的选择器 - 异常
-
RuntimeException
- 如果已经安装了选择器面板
-
uninstallChooserPanel
public void uninstallChooserPanel(JColorChooser enclosingChooser)
从选择器中删除面板时调用。 如果覆盖此项,请务必致电super
。- 参数
-
enclosingChooser
- 要从中移除面板的选择器
-
getColorSelectionModel
public ColorSelectionModel getColorSelectionModel()
返回选择器面板正在编辑的模型。- 结果
- 这个面板正在编辑的
ColorSelectionModel
型号
-
getColorFromModel
protected Color getColorFromModel()
返回当前选定的颜色。- 结果
- 选中的
Color
-
setColorTransparencySelectionEnabled
@BeanProperty(description="Sets the transparency of a color selection on or off.")public void setColorTransparencySelectionEnabled(boolean b)
设置颜色选择器面板是否允许选择颜色的透明度(alpha值)。 此方法使用字符串值TRANSPARENCY_ENABLED_PROPERTY
作为属性的名称来触发属性更改的事件。该值是一个提示,可能不适用于所有类型的选择器面板。
默认值为
true
。- 参数
-
b
- 如果可以选择颜色的透明度,b
true - 另请参见:
-
isColorTransparencySelectionEnabled()
-
isColorTransparencySelectionEnabled
public boolean isColorTransparencySelectionEnabled()
获取颜色选择器面板是否允许选择颜色的透明度(alpha值)。- 结果
- 如果可以选择颜色的透明度,则为true
- 另请参见:
-
setColorTransparencySelectionEnabled(boolean)
-
paint
public void paint(Graphics g)
绘制面板。
-
-