JavaTM 2 Platform
Standard Ed. 6

javax.swing.plaf.basic
類別 BasicArrowButton

java.lang.Object
  繼承者 java.awt.Component
      繼承者 java.awt.Container
          繼承者 javax.swing.JComponent
              繼承者 javax.swing.AbstractButton
                  繼承者 javax.swing.JButton
                      繼承者 javax.swing.plaf.basic.BasicArrowButton
所有已實作的介面:
ImageObserver, ItemSelectable, MenuContainer, Serializable, Accessible, SwingConstants
直接已知子類別:
MetalScrollButton

public class BasicArrowButton
extends JButton
implements SwingConstants

一個 JButton 物件,它繪製朝某個基本方向的縮放箭頭。

警告:此類別的序列化物件將與以後的 Swing 版本不相容。當前序列化支持適用於短期存儲,或適用於在運行相同 Swing 版本的應用程序之間進行 RMI(Remote Method Invocation,遠端方法調用)。從 1.4 版本開始,已在 java.beans 套件中添加了支持所有 JavaBeansTM 長期存儲的功能。請參見 XMLEncoder


巢狀類別摘要
 
從類別 javax.swing.JButton 繼承的巢狀類別/介面
JButton.AccessibleJButton
 
從類別 javax.swing.AbstractButton 繼承的巢狀類別/介面
AbstractButton.AccessibleAbstractButton, AbstractButton.ButtonChangeListener
 
從類別 javax.swing.JComponent 繼承的巢狀類別/介面
JComponent.AccessibleJComponent
 
從類別 java.awt.Container 繼承的巢狀類別/介面
Container.AccessibleAWTContainer
 
從類別 java.awt.Component 繼承的巢狀類別/介面
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
欄位摘要
protected  int direction
          箭頭的方向。
 
從類別 javax.swing.AbstractButton 繼承的欄位
actionListener, BORDER_PAINTED_CHANGED_PROPERTY, changeEvent, changeListener, CONTENT_AREA_FILLED_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, itemListener, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, model, MODEL_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY
 
從類別 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
 
從介面 javax.swing.SwingConstants 繼承的欄位
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
從介面 java.awt.image.ImageObserver 繼承的欄位
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
建構子摘要
BasicArrowButton(int direction)
          創建一個在指定方向上繪製其箭頭的 BasicArrowButton
BasicArrowButton(int direction, Color background, Color shadow, Color darkShadow, Color highlight)
          創建一個在指定方向上繪製其箭頭並具有指定顏色的 BasicArrowButton
 
方法摘要
 int getDirection()
          返回箭頭的方向。
 Dimension getMaximumSize()
          返回 BasicArrowButton 的最大大小。
 Dimension getMinimumSize()
          返回 BasicArrowButton 的最小大小。
 Dimension getPreferredSize()
          返回 BasicArrowButton 的首選大小。
 boolean isFocusTraversable()
          返回箭頭按鈕是否應該獲取焦點。
 void paint(Graphics g)
          由 Swing 調用,以繪製元件。
 void paintTriangle(Graphics g, int x, int y, int size, int direction, boolean isEnabled)
          繪製一個三角形。
 void setDirection(int dir)
          設置箭頭的方向。
 
從類別 javax.swing.JButton 繼承的方法
getAccessibleContext, getUIClassID, isDefaultButton, isDefaultCapable, paramString, removeNotify, setDefaultCapable, updateUI
 
從類別 javax.swing.AbstractButton 繼承的方法
actionPropertyChanged, addActionListener, addChangeListener, addImpl, addItemListener, checkHorizontalKey, checkVerticalKey, configurePropertiesFromAction, createActionListener, createActionPropertyChangeListener, createChangeListener, createItemListener, doClick, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getAction, getActionCommand, getActionListeners, getChangeListeners, getDisabledIcon, getDisabledSelectedIcon, getDisplayedMnemonicIndex, getHideActionText, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getItemListeners, getLabel, getMargin, getMnemonic, getModel, getMultiClickThreshhold, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, imageUpdate, init, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, isSelected, paintBorder, removeActionListener, removeChangeListener, removeItemListener, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setEnabled, setFocusPainted, setHideActionText, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabel, setLayout, setMargin, setMnemonic, setMnemonic, setModel, setMultiClickThreshhold, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, setText, setUI, setVerticalAlignment, setVerticalTextPosition
 
從類別 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, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, 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, 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, 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, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, 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
 

欄位詳細資訊

direction

protected int direction
箭頭的方向。SwingConstants.NORTHSwingConstants.SOUTHSwingConstants.EASTSwingConstants.WEST 之一。

建構子詳細資訊

BasicArrowButton

public BasicArrowButton(int direction,
                        Color background,
                        Color shadow,
                        Color darkShadow,
                        Color highlight)
創建一個在指定方向上繪製其箭頭並具有指定顏色的 BasicArrowButton

參數:
direction - 箭頭的方向;SwingConstants.NORTHSwingConstants.SOUTHSwingConstants.EASTSwingConstants.WEST 之一
background - 按鈕的背景色
shadow - 陰影的顏色
darkShadow - 黑陰影的顏色
highlight - 高亮顯示的顏色
從以下版本開始:
1.4

BasicArrowButton

public BasicArrowButton(int direction)
創建一個在指定方向上繪製其箭頭的 BasicArrowButton

參數:
direction - 箭頭的方向;SwingConstants.NORTHSwingConstants.SOUTHSwingConstants.EASTSwingConstants.WEST 之一
方法詳細資訊

getDirection

public int getDirection()
返回箭頭的方向。

參數:
direction - 箭頭的方向;SwingConstants.NORTHSwingConstants.SOUTHSwingConstants.EASTSwingConstants.WEST 之一

setDirection

public void setDirection(int dir)
設置箭頭的方向。

參數:
direction - 箭頭的方向;SwingConstants.NORTHSwingConstants.SOUTHSwingConstants.EASTSwingConstants.WEST 之一

paint

public void paint(Graphics g)
從類別 JComponent 複製的描述
由 Swing 調用,以繪製元件。應用程序不應直接調用 paint,而是應該使用 repaint 方法來安排重繪元件。

此方法實際上將繪製工作委託給三個受保護的方法:paintComponentpaintBorderpaintChildren。按列出的順序調用這些方法,以確保子元件出現在元件本身的頂部。一般來說,不應在分派給邊框的 insets 區域繪製元件及其子元件。子類別可以始終覆寫此方法。只想特殊化 UI(外觀)委託的 paint 方法的子類別只需覆寫 paintComponent

覆寫:
類別 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)

getPreferredSize

public Dimension getPreferredSize()
返回 BasicArrowButton 的首選大小。

覆寫:
類別 JComponent 中的 getPreferredSize
返回:
首選大小
另請參見:
JComponent.setPreferredSize(java.awt.Dimension), ComponentUI

getMinimumSize

public Dimension getMinimumSize()
返回 BasicArrowButton 的最小大小。

覆寫:
類別 JComponent 中的 getMinimumSize
返回:
最小大小
另請參見:
JComponent.setMinimumSize(java.awt.Dimension), ComponentUI

getMaximumSize

public Dimension getMaximumSize()
返回 BasicArrowButton 的最大大小。

覆寫:
類別 JComponent 中的 getMaximumSize
返回:
最大大小
另請參見:
JComponent.setMaximumSize(java.awt.Dimension), ComponentUI

isFocusTraversable

public boolean isFocusTraversable()
返回箭頭按鈕是否應該獲取焦點。BasicArrowButton 用作復合元件(如 JScrollBarJComboBox)的子元件。因為通常是復合元件獲取焦點,所以覆寫此方法以返回 false

覆寫:
類別 Component 中的 isFocusTraversable
返回:
false
另請參見:
Component.setFocusable(boolean)

paintTriangle

public void paintTriangle(Graphics g,
                          int x,
                          int y,
                          int size,
                          int direction,
                          boolean isEnabled)
繪製一個三角形。

參數:
g - 要在其上進行繪製的 Graphics
x - x 坐標
y - y 坐標
size - 要繪製的三角形的大小
direction - 繪製箭頭的方向;SwingConstants.NORTHSwingConstants.SOUTHSwingConstants.EASTSwingConstants.WEST 之一
isEnabled - 是否已啟用繪製箭頭

JavaTM 2 Platform
Standard Ed. 6

提交錯誤或意見

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