JavaTM 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 Platform
Standard Ed. 6

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策