Package com.nomagic.awt
Class NMJideButton
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.AbstractButton
javax.swing.JButton
com.jidesoft.swing.JideButton
com.nomagic.awt.NMJideButton
- All Implemented Interfaces:
com.jidesoft.swing.Alignable,com.jidesoft.swing.AlignmentSupport,com.jidesoft.swing.ButtonStyle,com.jidesoft.swing.ComponentStateSupport,com.nomagic.awt.HelpInformationProvider,KeyListener,MouseListener,ImageObserver,ItemSelectable,MenuContainer,Serializable,EventListener,Accessible,SwingConstants
- Direct Known Subclasses:
NMActionJideButton
@OpenApi
public class NMJideButton
extends com.jidesoft.swing.JideButton
implements MouseListener, Serializable, KeyListener, com.nomagic.awt.HelpInformationProvider
This is simple image popup button bean. Then user moves mouse on it, button
border is drawn as raised 3D rectangle; if button is pushed, it's border is drawn
as hollow 3D rectangle. Button size is the same as image size.
This button has three modes:
pushed - is button pushed
toggle - is button a toggle button. If button is not a toggle button, the user can
only push it (not to release)
sticky - is button is a sticky button. If button is not sticky,
after mouse released it will lose it's pushed state. The button can registry
ActionListeners. ActionEvent is fired when user
presses and releases mouse on the button. If mouse was only pressed on the
button and releases elsewhere, ActionEvent is not fired. The
button also can registry HelpListeners. HelpEvent
is fired when user moves mouse pointer on the button or moves it out. When
mouse moves in HelpEvent is fired with parameter
getTooltipText(), when mouse moves out, HelpEvent
is fired with parameter null.- See Also:
-
Field Summary
Fields inherited from class com.jidesoft.swing.JideButton
CLIENT_PROPERTY_HIDE_POPUPMENU, PROPERTY_ALWAYS_SHOW_HYPERLINKFields 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 com.jidesoft.swing.Alignable
PROPERTY_ORIENTATIONFields inherited from interface com.jidesoft.swing.ButtonStyle
BUTTON_STYLE_PROPERTY, CLIENT_PROPERTY_SEGMENT_POSITION, FLAT_STYLE, HYPERLINK_STYLE, SEGMENT_POSITION_FIRST, SEGMENT_POSITION_LAST, SEGMENT_POSITION_MIDDLE, SEGMENT_POSITION_ONLY, TOOLBAR_STYLE, TOOLBOX_STYLEFields 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
ConstructorsConstructorDescriptionConstructs not pushed button with no image, empty command string and empty help string.NMJideButton(Action action) Creates button from given action.NMJideButton(Icon icon) Creates button with given icon. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddHelpListener(com.nomagic.awt.HelpListener l) Informs the component that this HelpListener is interested in the help events generated by this component.voidReturn special implementation of tooltip componentGets list of shortcut for button activationgetToolTipLocation(MouseEvent event) final BiFunction<NMJideButton,MouseEvent, Point> voidkeyPressed(KeyEvent evt) voidkeyReleased(KeyEvent evt) voidvoidvoidProcesses the mouse enter action.voidProcesses the mouse exit action.voidProcesses the mouse pressed action.voidProcesses the mouse release event.voidnotifyHelpListeners(String newHelp) Processes the mouse enter and mouse exit events.voidremoveHelpListener(com.nomagic.awt.HelpListener l) Informs the component that this HelpListener is no longer interested in the help events generated by this component.voidvoidThis method is called if right click is done on the button.voidvoidsetShortcuts(List shortcuts) Sets shortcut for popup button.final voidsetToolTipLocationProvider(BiFunction<NMJideButton, MouseEvent, Point> toolTipLocationProvider) voidsetToolTipText(String text) Registers the text to display in a tool tip.Methods inherited from class com.jidesoft.swing.JideButton
getBackgroundOfState, getButtonStyle, getDefaultForeground, getForegroundOfState, getOrientation, getUIClassID, isAlwaysShowHyperlink, setAlwaysShowHyperlink, setBackgroundOfState, setButtonStyle, setDefaultForeground, setForegroundOfState, setOrientation, setRolloverEnabled, setText, supportHorizontalOrientation, supportVerticalOrientation, updateUIMethods inherited from class javax.swing.JButton
getAccessibleContext, isDefaultButton, isDefaultCapable, paramString, setDefaultCapableMethods 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, setIconTextGap, setLabel, setLayout, setMargin, setMnemonic, setMnemonic, setModel, setMultiClickThreshhold, setPressedIcon, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, setUI, setVerticalAlignment, setVerticalTextPositionMethods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, 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, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, 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, 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, transferFocusUpCycleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.jidesoft.swing.AlignmentSupport
getHorizontalAlignment, getVerticalAlignment, setHorizontalAlignment, setVerticalAlignment
-
Constructor Details
-
NMJideButton
@OpenApi public NMJideButton()Constructs not pushed button with no image, empty command string and empty help string. The size of the button will be zero. -
NMJideButton
Creates button from given action.- See Also:
-
NMJideButton
Creates button with given icon.- Parameters:
icon- icon for button.- See Also:
-
-
Method Details
-
setIcon
- Overrides:
setIconin classcom.jidesoft.swing.JideButton
-
mouseReleased
Processes the mouse release event. At first this method checks if the button has focus (mFocus is true). If this is true, ActionEvent will be thrown.- Specified by:
mouseReleasedin interfaceMouseListener- Parameters:
e- the release mouse event;
-
rightClickAction
This method is called if right click is done on the button.- Parameters:
e- click event.
-
mouseClicked
- Specified by:
mouseClickedin interfaceMouseListener- See Also:
-
mousePressed
Processes the mouse pressed action. After press button must be drawn as pushed.- Specified by:
mousePressedin interfaceMouseListener- Parameters:
e- MouseEvent
-
mouseEntered
Processes the mouse enter action. This method sets focus flag, and notifies HelpListeners with parameter "help string".- Specified by:
mouseEnteredin interfaceMouseListener- Parameters:
e- MouseEvent
-
mouseExited
Processes the mouse exit action. Calls notifyHelpListeners method with null as parameter.- Specified by:
mouseExitedin interfaceMouseListener- Parameters:
e- MouseEvent- See Also:
-
addHelpListener
public void addHelpListener(com.nomagic.awt.HelpListener l) Informs the component that this HelpListener is interested in the help events generated by this component.- Specified by:
addHelpListenerin interfacecom.nomagic.awt.HelpInformationProvider- Parameters:
l- the HelpListener- See Also:
-
removeHelpListener
public void removeHelpListener(com.nomagic.awt.HelpListener l) Informs the component that this HelpListener is no longer interested in the help events generated by this component.- Specified by:
removeHelpListenerin interfacecom.nomagic.awt.HelpInformationProvider- Parameters:
l- the HelpListener- See Also:
-
notifyHelpListeners
Processes the mouse enter and mouse exit events. This method calls the helpChanged() methods of all the listeners who have expressed their interest by calling addHelpListener- Parameters:
newHelp- the new help string for HelpEvent
-
setShortcuts
Sets shortcut for popup button. -
getShortcuts
Gets list of shortcut for button activation- Returns:
- list of shortcuts.
-
keyPressed
- Specified by:
keyPressedin interfaceKeyListener
-
keyReleased
- Specified by:
keyReleasedin interfaceKeyListener
-
keyTyped
- Specified by:
keyTypedin interfaceKeyListener
-
setToolTipText
Registers the text to display in a tool tip. The text displays when the cursor lingers over the component.See How to Use Tool Tips in The Java Tutorial for further documentation.
- Overrides:
setToolTipTextin classJComponent- Parameters:
text- the string to display; if the text isnull, the tool tip is turned off for this component- See Also:
-
createToolTip
Return special implementation of tooltip component- Overrides:
createToolTipin classJComponent
-
addNotify
public void addNotify()- Overrides:
addNotifyin classJComponent
-
removeNotify
public void removeNotify()- Overrides:
removeNotifyin classJButton
-
setToolTipLocationProvider
public final void setToolTipLocationProvider(@CheckForNull BiFunction<NMJideButton, MouseEvent, Point> toolTipLocationProvider) -
getToolTipLocationProvider
-
getToolTipLocation
- Overrides:
getToolTipLocationin classJComponent
-