Class JSplitButton
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.AbstractButton
javax.swing.JButton
org.bidib.wizard.mvc.common.view.button.JSplitButton
- All Implemented Interfaces:
ActionListener,MouseListener,MouseMotionListener,ImageObserver,ItemSelectable,MenuContainer,Serializable,EventListener,Accessible,SwingConstants
@Deprecated
public class JSplitButton
extends JButton
implements MouseMotionListener, MouseListener, ActionListener, Serializable
Deprecated.
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.
Use as you wish, but an acknowlegement would be appreciated, ;)
Known Issue:
The 'button part' of the splitbutton is being drawn without the border??? and this is only happening in CDE/Motif and Metal Look and Feels. GTK+ and nimbus works perfect. No Idea why? if anybody could point out the mistake that'd be nice.My email naveedmurtuza[at]gmail.com
P.S. The fireXXX methods has been directly plagarized from JDK source code, and yes even the javadocs..;)
The border bug in metal Linvalid input: '&F' is now fixed. Thanks to Hervé Guillaume.
This class raises two events.
- buttonClicked(e); //when the button is clicked
- splitButtonClicked(e; //when the split part of the button is clicked)
Use as you wish, but an acknowlegement would be appreciated, ;)
Known Issue:
The 'button part' of the splitbutton is being drawn without the border??? and this is only happening in CDE/Motif and Metal Look and Feels. GTK+ and nimbus works perfect. No Idea why? if anybody could point out the mistake that'd be nice.My email naveedmurtuza[at]gmail.com
P.S. The fireXXX methods has been directly plagarized from JDK source code, and yes even the javadocs..;)
The border bug in metal Linvalid input: '&F' is now fixed. Thanks to Hervé Guillaume.
- Author:
- Naveed Quadri
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JButton
JButton.AccessibleJButtonNested classes/interfaces inherited from class javax.swing.AbstractButton
AbstractButton.AccessibleAbstractButton, AbstractButton.ButtonChangeListenerNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsFields inherited from class 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_PROPERTYFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields inherited from interface 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 -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Creates a button with no set text or icon.JSplitButton(String text) Deprecated.Creates a button with text.JSplitButton(String text, Icon icon) Deprecated.Creates a button with initial text and an icon.JSplitButton(Icon icon) Deprecated.Creates a button with an icon. -
Method Summary
Modifier and TypeMethodDescriptionvoidDeprecated.voidDeprecated.Adds anSplitButtonActionListenerto the button.Deprecated.Gets the color of the arrow.intDeprecated.gets the size of the arrow.Deprecated.gets the disabled arrow colorDeprecated.Gets the disabled image to be drawn in the split part.getImage()Deprecated.Gets the image to be drawn in the split part.Deprecated.Returns the JPopupMenu if set, null otherwise.Deprecated.intDeprecated.Returns the separatorSpacing.intDeprecated.Splitwidth is the width of the split part of the button.booleanDeprecated.Show the dropdown menu, if attached, even if the button part is clicked.voidDeprecated.voidDeprecated.voidDeprecated.voidDeprecated.voidDeprecated.voidDeprecated.voidDeprecated.protected voidDeprecated.voidDeprecated.Removes anSplitButtonActionListenerfrom the button.voidsetAlwaysDropDown(boolean alwaysDropDown) Deprecated.Show the dropdown menu, if attached, even if the button part is clicked.voidsetArrowColor(Color arrowColor) Deprecated.Set the arrow color.voidsetArrowSize(int arrowSize) Deprecated.sets the size of the arrowvoidsetDisabledArrowColor(Color disabledArrowColor) Deprecated.sets the disabled arrow colorvoidDeprecated.Sets the image to draw instead of the triangle.voidsetPopupMenu(JPopupMenu popupMenu) Deprecated.Sets the JPopupMenu to be displayed, when the split part of the button is clicked.voidsetRecalculateWidth(boolean recalculateWidth) Deprecated.voidsetSeparatorSpacing(int separatorSpacing) Deprecated.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) Deprecated.Splitwidth is the width of the split part of the button.Methods inherited from class javax.swing.JButton
getAccessibleContext, getUIClassID, isDefaultButton, isDefaultCapable, paramString, removeNotify, setDefaultCapable, updateUIMethods inherited from class 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, setVerticalTextPositionMethods inherited from class 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, 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, updateMethods inherited from class 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, validateTreeMethods inherited from class 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, 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, 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
-
Field Details
-
splitButtonActionListener
Deprecated.
-
-
Constructor Details
-
JSplitButton
Deprecated.Creates a button with initial text and an icon.- Parameters:
text- the text of the buttonicon- the Icon image to display on the button
-
JSplitButton
Deprecated.Creates a button with text.- Parameters:
text- the text of the button
-
JSplitButton
Deprecated.Creates a button with an icon.- Parameters:
icon- the Icon image to display on the button
-
JSplitButton
public JSplitButton()Deprecated.Creates a button with no set text or icon.
-
-
Method Details
-
getPopupMenu
Deprecated.Returns the JPopupMenu if set, null otherwise.- Returns:
- JPopupMenu
-
setPopupMenu
Deprecated.Sets the JPopupMenu to be displayed, when the split part of the button is clicked.- Parameters:
popupMenu-
-
getSeparatorSpacing
public int getSeparatorSpacing()Deprecated.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).- Returns:
- separatorSpacingimage = null; //to repaint the image with the new size
-
setSeparatorSpacing
public void setSeparatorSpacing(int separatorSpacing) Deprecated.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).- Parameters:
separatorSpacing-
-
isAlwaysDropDown
public boolean isAlwaysDropDown()Deprecated.Show the dropdown menu, if attached, even if the button part is clicked.- Returns:
- true if alwaysDropdown, false otherwise.
-
setAlwaysDropDown
public void setAlwaysDropDown(boolean alwaysDropDown) Deprecated.Show the dropdown menu, if attached, even if the button part is clicked.- Parameters:
alwaysDropDown- true to show the attached dropdown even if the button part is clicked, false otherwise
-
getArrowColor
Deprecated.Gets the color of the arrow.- Returns:
- arrowColor
-
setArrowColor
Deprecated.Set the arrow color.- Parameters:
arrowColor-
-
getDisabledArrowColor
Deprecated.gets the disabled arrow color- Returns:
- disabledArrowColor color of the arrow if no popup attached.
-
setDisabledArrowColor
Deprecated.sets the disabled arrow color- Parameters:
disabledArrowColor- color of the arrow if no popup attached.
-
getSplitWidth
public int getSplitWidth()Deprecated.Splitwidth is the width of the split part of the button.- Returns:
- splitWidth
-
setSplitWidth
public void setSplitWidth(int splitWidth) Deprecated.Splitwidth is the width of the split part of the button.- Parameters:
splitWidth-
-
getArrowSize
public int getArrowSize()Deprecated.gets the size of the arrow.- Returns:
- size of the arrow
-
setArrowSize
public void setArrowSize(int arrowSize) Deprecated.sets the size of the arrow- Parameters:
arrowSize-
-
setRecalculateWidth
public void setRecalculateWidth(boolean recalculateWidth) Deprecated. -
getPreferredSize
Deprecated.- Overrides:
getPreferredSizein classJComponent
-
getImage
Deprecated.Gets the image to be drawn in the split part. If no is set, a new image is created with the triangle.- Returns:
- image
-
getDisabledImage
Deprecated.Gets the disabled image to be drawn in the split part. If no is set, a new image is created with the triangle.- Returns:
- image
-
setImage
Deprecated.Sets the image to draw instead of the triangle.- Parameters:
image-
-
paintComponent
Deprecated.- Overrides:
paintComponentin classJComponent- Parameters:
g-
-
addSplitButtonActionListener
Deprecated.Adds anSplitButtonActionListenerto the button.- Parameters:
l- theActionListenerto be added
-
removeSplitButtonActionListener
Deprecated.Removes anSplitButtonActionListenerfrom the button. If the listener is the currently setActionfor the button, then theActionis set tonull.- Parameters:
l- the listener to be removed
-
mouseMoved
Deprecated.- Specified by:
mouseMovedin interfaceMouseMotionListener- Parameters:
e-
-
actionPerformed
Deprecated.- Specified by:
actionPerformedin interfaceActionListener- Parameters:
e-
-
mouseExited
Deprecated.- Specified by:
mouseExitedin interfaceMouseListener- Parameters:
e-
-
mouseDragged
Deprecated.- Specified by:
mouseDraggedin interfaceMouseMotionListener
-
mouseClicked
Deprecated.- Specified by:
mouseClickedin interfaceMouseListener
-
mousePressed
Deprecated.- Specified by:
mousePressedin interfaceMouseListener
-
mouseReleased
Deprecated.- Specified by:
mouseReleasedin interfaceMouseListener
-
mouseEntered
Deprecated.- Specified by:
mouseEnteredin interfaceMouseListener
-