程序包 org.meteoinfo.ui
类 JSplitToggleButton
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.AbstractButton
-
- javax.swing.JToggleButton
-
- org.meteoinfo.ui.JSplitToggleButton
-
- 所有已实现的接口:
ActionListener,MouseListener,MouseMotionListener,ImageObserver,ItemSelectable,MenuContainer,Serializable,EventListener,Accessible,SwingConstants
public class JSplitToggleButton extends JToggleButton implements MouseMotionListener, MouseListener, ActionListener, Serializable
An implementation of a "split" button.The left side acts like a normal button, right side has a jPopupMenu attached. This class raises two events.- buttonClicked(e); //when the button is clicked
- splitButtonClicked(e; //when the split part of the button is clicked)
- 作者:
- Naveed Quadri
- 另请参阅:
- 序列化表格
-
-
嵌套类概要
-
从类继承的嵌套类/接口 javax.swing.JToggleButton
JToggleButton.AccessibleJToggleButton, JToggleButton.ToggleButtonModel
-
从类继承的嵌套类/接口 javax.swing.AbstractButton
AbstractButton.AccessibleAbstractButton, AbstractButton.ButtonChangeListener
-
从类继承的嵌套类/接口 javax.swing.JComponent
JComponent.AccessibleJComponent
-
从类继承的嵌套类/接口 java.awt.Container
Container.AccessibleAWTContainer
-
-
字段概要
字段 修饰符和类型 字段 说明 protected SplitButtonActionListenersplitButtonActionListener-
从类继承的字段 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
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
-
从接口继承的字段 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
从接口继承的字段 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
-
-
构造器概要
构造器 构造器 说明 JSplitToggleButton()Creates a button with no set text or icon.JSplitToggleButton(String text)Creates a button with text.JSplitToggleButton(String text, Icon icon)Creates a button with initial text and an icon.JSplitToggleButton(Icon icon)Creates a button with an icon.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidactionPerformed(ActionEvent e)voidaddSplitButtonActionListener(SplitButtonActionListener l)Adds anSplitButtonActionListenerto the button.ColorgetArrowColor()Gets the color of the arrow.intgetArrowSize()gets the size of the arrow.ColorgetDisabledArrowColor()gets the disabled arrow colorImagegetImage()Gets the image to be drawn in the split part.JPopupMenugetPopupMenu()Returns the JPopupMenu if set, null otherwise.intgetSeparatorSpacing()Returns the separatorSpacing.RectanglegetSplitRectangle()Get split rectangleintgetSplitWidth()Splitwidth is the width of the split part of the button.booleanisAlwaysDropDown()Show the dropdown menu, if attached, even if the button part is clicked.booleanisOnSplit()Get if the mouse point on split rectanglevoidmouseClicked(MouseEvent e)voidmouseDragged(MouseEvent e)voidmouseEntered(MouseEvent e)voidmouseExited(MouseEvent e)voidmouseMoved(MouseEvent e)voidmousePressed(MouseEvent e)voidmouseReleased(MouseEvent e)protected voidpaintComponent(Graphics g)voidremoveSplitButtonActionListener(SplitButtonActionListener l)Removes anSplitButtonActionListenerfrom the button.voidsetAlwaysDropDown(boolean alwaysDropDown)Show the dropdown menu, if attached, even if the button part is clicked.voidsetArrowColor(Color arrowColor)Set the arrow color.voidsetArrowSize(int arrowSize)sets the size of the arrowvoidsetDisabledArrowColor(Color disabledArrowColor)sets the disabled arrow colorvoidsetImage(Image image)Sets the image to draw instead of the triangle.voidsetPopupMenu(JPopupMenu popupMenu)Sets the JPopupMenu to be displayed, when the split part of the button is clicked.voidsetSeparatorSpacing(int separatorSpacing)Sets the separatorSpacing.Separator spacing is the space above and below the separator( the line drawn when you hover your mouse over the split part of the button).voidsetSplitWidth(int splitWidth)Splitwidth is the width of the split part of the button.-
从类继承的方法 javax.swing.JToggleButton
getAccessibleContext, getUIClassID, paramString, 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, removeNotify, 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, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, 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, 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, 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, transferFocusBackward, transferFocusUpCycle
-
-
-
-
字段详细资料
-
splitButtonActionListener
protected SplitButtonActionListener splitButtonActionListener
-
-
构造器详细资料
-
JSplitToggleButton
public JSplitToggleButton(String text, Icon icon)
Creates a button with initial text and an icon.- 参数:
text- the text of the buttonicon- the Icon image to display on the button
-
JSplitToggleButton
public JSplitToggleButton(String text)
Creates a button with text.- 参数:
text- the text of the button
-
JSplitToggleButton
public JSplitToggleButton(Icon icon)
Creates a button with an icon.- 参数:
icon- the Icon image to display on the button
-
JSplitToggleButton
public JSplitToggleButton()
Creates a button with no set text or icon.
-
-
方法详细资料
-
getPopupMenu
public JPopupMenu getPopupMenu()
Returns the JPopupMenu if set, null otherwise.- 返回:
- JPopupMenu
-
setPopupMenu
public void setPopupMenu(JPopupMenu popupMenu)
Sets the JPopupMenu to be displayed, when the split part of the button is clicked.- 参数:
popupMenu-
-
getSeparatorSpacing
public int getSeparatorSpacing()
Returns the separatorSpacing. Separator spacing is the space above and below the separator( the line drawn when you hover your mouse over the split part of the button).- 返回:
- separatorSpacingimage = null; //to repaint the image with the new size
-
setSeparatorSpacing
public void setSeparatorSpacing(int separatorSpacing)
Sets the separatorSpacing.Separator spacing is the space above and below the separator( the line drawn when you hover your mouse over the split part of the button).- 参数:
separatorSpacing-
-
isAlwaysDropDown
public boolean isAlwaysDropDown()
Show the dropdown menu, if attached, even if the button part is clicked.- 返回:
- true if alwaysDropdown, false otherwise.
-
setAlwaysDropDown
public void setAlwaysDropDown(boolean alwaysDropDown)
Show the dropdown menu, if attached, even if the button part is clicked.- 参数:
alwaysDropDown- true to show the attached dropdown even if the button part is clicked, false otherwise
-
getArrowColor
public Color getArrowColor()
Gets the color of the arrow.- 返回:
- arrowColor
-
setArrowColor
public void setArrowColor(Color arrowColor)
Set the arrow color.- 参数:
arrowColor-
-
getDisabledArrowColor
public Color getDisabledArrowColor()
gets the disabled arrow color- 返回:
- disabledArrowColor color of the arrow if no popup attached.
-
setDisabledArrowColor
public void setDisabledArrowColor(Color disabledArrowColor)
sets the disabled arrow color- 参数:
disabledArrowColor- color of the arrow if no popup attached.
-
getSplitWidth
public int getSplitWidth()
Splitwidth is the width of the split part of the button.- 返回:
- splitWidth
-
setSplitWidth
public void setSplitWidth(int splitWidth)
Splitwidth is the width of the split part of the button.- 参数:
splitWidth-
-
getSplitRectangle
public Rectangle getSplitRectangle()
Get split rectangle- 返回:
- Split rectangle
-
isOnSplit
public boolean isOnSplit()
Get if the mouse point on split rectangle- 返回:
- Boolean
-
getArrowSize
public int getArrowSize()
gets the size of the arrow.- 返回:
- size of the arrow
-
setArrowSize
public void setArrowSize(int arrowSize)
sets the size of the arrow- 参数:
arrowSize-
-
getImage
public Image getImage()
Gets the image to be drawn in the split part. If no is set, a new image is created with the triangle.- 返回:
- image
-
setImage
public void setImage(Image image)
Sets the image to draw instead of the triangle.- 参数:
image-
-
paintComponent
protected void paintComponent(Graphics g)
- 覆盖:
paintComponent在类中JComponent- 参数:
g-
-
addSplitButtonActionListener
public void addSplitButtonActionListener(SplitButtonActionListener l)
Adds anSplitButtonActionListenerto the button.- 参数:
l- theActionListenerto be added
-
removeSplitButtonActionListener
public void removeSplitButtonActionListener(SplitButtonActionListener l)
Removes anSplitButtonActionListenerfrom the button. If the listener is the currently setActionfor the button, then theActionis set tonull.- 参数:
l- the listener to be removed
-
mouseMoved
public void mouseMoved(MouseEvent e)
- 指定者:
mouseMoved在接口中MouseMotionListener- 参数:
e-
-
actionPerformed
public void actionPerformed(ActionEvent e)
- 指定者:
actionPerformed在接口中ActionListener- 参数:
e-
-
mouseExited
public void mouseExited(MouseEvent e)
- 指定者:
mouseExited在接口中MouseListener- 参数:
e-
-
mouseDragged
public void mouseDragged(MouseEvent e)
- 指定者:
mouseDragged在接口中MouseMotionListener
-
mouseClicked
public void mouseClicked(MouseEvent e)
- 指定者:
mouseClicked在接口中MouseListener
-
mousePressed
public void mousePressed(MouseEvent e)
- 指定者:
mousePressed在接口中MouseListener
-
mouseReleased
public void mouseReleased(MouseEvent e)
- 指定者:
mouseReleased在接口中MouseListener
-
mouseEntered
public void mouseEntered(MouseEvent e)
- 指定者:
mouseEntered在接口中MouseListener
-
-