JavaTM 2 Platform
Standard Ed. 6

javax.swing.colorchooser
類別 AbstractColorChooserPanel

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 AbstractColorChooserPanel
extends JPanel

這是用於顏色選取器的抽象父級類別。如果希望在 JColorChooser 中添加一個新的顏色選取器面板,請創建該類別的子類別。

警告:此類別已序列化的物件將不再與以後的 Swing 版本相容。當前的序列化支持適合在運行相同 Swing 版本的應用程序之間短期存儲或 RMI。從 1.4 版開始,已在 java.beans 套件中加入對所有 JavaBeansTM 的長期存儲支持。請參見 XMLEncoder


巢狀類別摘要
 
從類別 javax.swing.JPanel 繼承的巢狀類別/介面
JPanel.AccessibleJPanel
 
從類別 javax.swing.JComponent 繼承的巢狀類別/介面
JComponent.AccessibleJComponent
 
從類別 java.awt.Container 繼承的巢狀類別/介面
Container.AccessibleAWTContainer
 
從類別 java.awt.Component 繼承的巢狀類別/介面
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
欄位摘要
 
從類別 javax.swing.JComponent 繼承的欄位
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
從類別 java.awt.Component 繼承的欄位
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
從介面 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)
          將面板添加到選取器時被調用。
 void paint(Graphics g)
          繪製面板。
 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, 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, 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, transferFocusBackward, 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, 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, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
從類別 java.lang.Object 繼承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

建構子詳細資訊

AbstractColorChooserPanel

public AbstractColorChooserPanel()
方法詳細資訊

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,外觀應當只用助記符。

這裡的返回值是一個提示,最終由外觀來為此返回值賦予真實的含義。例如,外觀希望在 JTabbedPane 中呈現每個 AbstractColorChooserPanel,然後進一步使用該返回值來為 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


getColorSelectionModel

public ColorSelectionModel getColorSelectionModel()
返回選取器面板正在編輯的模型。

返回:
此面板正在編輯的 ColorSelectionModel 模型

getColorFromModel

protected Color getColorFromModel()
返回當前所選取的顏色。

返回:
所選取的 Color

paint

public void paint(Graphics g)
繪製面板。

覆寫:
類別 JComponent 中的 paint
參數:
g - Graphics 物件
另請參見:
JComponent.paintComponent(java.awt.Graphics), JComponent.paintBorder(java.awt.Graphics), JComponent.paintChildren(java.awt.Graphics), JComponent.getComponentGraphics(java.awt.Graphics), JComponent.repaint(long, int, int, int, int)

JavaTM 2 Platform
Standard Ed. 6

提交錯誤或意見

版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only