LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.view.win.swing.component
Class LyJButton

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.AbstractButton
                  extended by javax.swing.JButton
                      extended by leon.view.win.swing.component.LyJButton
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.ItemSelectable, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.SwingConstants, LyEventTransmitter, LyGetIdInterface
Direct Known Subclasses:
LyJOpenerButton

public class LyJButton
extends javax.swing.JButton
implements java.awt.event.ActionListener, java.awt.event.MouseListener, LyGetIdInterface, LyEventTransmitter, java.beans.PropertyChangeListener

This class implements a simple label with an image.

See Also:
Serialized Form

Nested Class Summary
 class LyJButton._LyJButtonModel
          This class is used as ButtonModel for LyJButton.
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
static java.lang.String __VERSION
           
static java.awt.Color FOCUS_COLOR
          Color of the focus for the default look and feel.
static int TIP_MAX_CHARS
          The maximum number of characters of this button tooltip.
 
Fields inherited from class javax.swing.AbstractButton
BORDER_PAINTED_CHANGED_PROPERTY, 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, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, 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
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields 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
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
LyJButton(java.awt.Image image)
          Creates a new Button component with the specified options.
LyJButton(java.awt.Image image, java.lang.String tooltip)
          Creates a new Button component with the specified options.
LyJButton(java.awt.Image image, java.lang.String label, java.lang.String tooltip, java.lang.String id)
          Creates a new Button component with the specified options.
LyJButton(java.awt.Image image, java.lang.String label, java.lang.String tooltip, java.lang.String id, boolean rollover)
          Creates a new Button component with the specified options.
LyJButton(java.lang.String label)
          Creates a new Button component with the specified options.
LyJButton(java.lang.String label, java.awt.Image image)
          Creates a new Button component with the specified options.
LyJButton(java.lang.String label, java.awt.Image image, boolean rollover)
          Creates a new Button component with the specified options.
LyJButton(java.net.URL url, java.awt.Image image, java.lang.String label, java.lang.String tooltip, java.lang.String id)
          Creates a new Button component with the specified options.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          (non-Javadoc).
 void callActionPerformed(java.awt.event.ActionEvent e)
          Performes the specified action.
 LyActionTransmitter getActionTransmitter()
          (non-Javadoc).
 java.lang.String getId()
          (non-Javadoc).
 java.awt.Image getImage()
          Gets the image of this button.
 java.awt.Insets getInsets()
          Compacts toobars.
 LySelectionTransmitter getSelectionTransmitter()
          This button doesn't handle selection events, so it has no selection transmitter.
 java.awt.Point getToolTipLocation(java.awt.event.MouseEvent event)
          Deactivate multiple mouse enter on buttons.
 boolean hasFocus()
          (non-Javadoc).
 void init()
          Registers the action and mouse listeners of this button.
 void mouseClicked(java.awt.event.MouseEvent e)
          Used to manage the repeat mode.
 void mouseEntered(java.awt.event.MouseEvent e)
          Doesn't do anything.
 void mouseExited(java.awt.event.MouseEvent e)
          Used to manage the repeat mode.
 void mousePressed(java.awt.event.MouseEvent e)
          Used to manage the repeat mode.
 void mouseReleased(java.awt.event.MouseEvent e)
          Used to manage the repeat mode.
 void propertyChange(java.beans.PropertyChangeEvent e)
          Generates a warning message on the standard output.
 void setEnabled(boolean b)
          (non-Javadoc).
 void setEnvironment(LyEnvironment environment)
          Sets the environment of the button.
 void setFont(java.awt.Font font)
          (non-Javadoc).
 void setGrayProp(int grayProp)
          Sets the gray proportion of the image used when mouse is not over the button.
 void setImage(java.awt.Image image)
          Sets the image displayed by the button.
 void setImage(java.net.URL url, java.awt.Image image)
          Sets the image displayed by the button.
 void setOpenerButton(LyJOpenerButton openerButton)
          Sets the opener button associated with current one.
 void setRepeatEnabled(boolean repeat)
          Activates or deactivates repeat mode.
 void setRollover(boolean roll)
          Sets the rollover property of this boolean.
 void setRolloverChangeBackground(boolean rollover)
          Indicates if background must be changed when mouse is over the button.
 void setRolloverEnabled(boolean roll)
          (non-Javadoc).
 void setUI(javax.swing.plaf.ButtonUI ui)
          (non-Javadoc).
 java.lang.String toString()
          Prints the content of this button object.
 
Methods inherited from class javax.swing.JButton
getAccessibleContext, getUIClassID, isDefaultButton, isDefaultCapable, removeNotify, setDefaultCapable, updateUI
 
Methods inherited from class javax.swing.AbstractButton
addActionListener, addChangeListener, addItemListener, doClick, doClick, 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, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, isSelected, removeActionListener, removeChangeListener, removeItemListener, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setFocusPainted, setHideActionText, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabel, setLayout, setMargin, setMnemonic, setMnemonic, setModel, setMultiClickThreshhold, setPressedIcon, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, setText, setVerticalAlignment, setVerticalTextPosition
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, hide, 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, 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, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
See Also:
Constant Field Values

TIP_MAX_CHARS

public static int TIP_MAX_CHARS
The maximum number of characters of this button tooltip.


FOCUS_COLOR

public static java.awt.Color FOCUS_COLOR
Color of the focus for the default look and feel.

Constructor Detail

LyJButton

public LyJButton(java.lang.String label)
Creates a new Button component with the specified options. Initializes the class fields to the specified values, or to the default values if not specified.

This button is double buffered.

Parameters:
label - the label of this button

LyJButton

public LyJButton(java.lang.String label,
                 java.awt.Image image)
Creates a new Button component with the specified options. Initializes the class fields to the specified values, or to the default values if not specified.

This button is double buffered.

Parameters:
image - the image to associate to the button
label - the label of this button

LyJButton

public LyJButton(java.lang.String label,
                 java.awt.Image image,
                 boolean rollover)
Creates a new Button component with the specified options. Initializes the class fields to the specified values, or to the default values if not specified.

This button is double buffered.

Parameters:
image - the image to associate to the button
label - the label of this button
rollover - the rollover property

LyJButton

public LyJButton(java.awt.Image image)
Creates a new Button component with the specified options. Initializes the class fields to the specified values, or to the default values if not specified.

This button is double buffered.

Parameters:
image - the image to associate to the button

LyJButton

public LyJButton(java.awt.Image image,
                 java.lang.String tooltip)
Creates a new Button component with the specified options. Initializes the class fields to the specified values, or to the default values if not specified.

This button is double buffered.

Parameters:
image - the image to associate to the button
tooltip - the tooltip

LyJButton

public LyJButton(java.awt.Image image,
                 java.lang.String label,
                 java.lang.String tooltip,
                 java.lang.String id)
Creates a new Button component with the specified options. Initializes the class fields to the specified values, or to the default values if not specified.

This button is double buffered.

Parameters:
image - the image to associate to the button
label - the label of this button
tooltip - the tooltip
id - the identifier string

LyJButton

public LyJButton(java.net.URL url,
                 java.awt.Image image,
                 java.lang.String label,
                 java.lang.String tooltip,
                 java.lang.String id)
Creates a new Button component with the specified options. Initializes the class fields to the specified values, or to the default values if not specified.

This button is double buffered.

Parameters:
url - the image url to associate to the button
image - the image to associate to the button
label - the label of this button
tooltip - the tooltip
id - the identifier string

LyJButton

public LyJButton(java.awt.Image image,
                 java.lang.String label,
                 java.lang.String tooltip,
                 java.lang.String id,
                 boolean rollover)
Creates a new Button component with the specified options. Initializes the class fields to the specified values, or to the default values if not specified.

This button is double buffered.

Parameters:
image - the image to associate to the button
label - the label of this button
tooltip - the tooltip
id - the identifier string
rollover - the rollover property
Method Detail

init

public void init()
Registers the action and mouse listeners of this button.


setRollover

public void setRollover(boolean roll)
Sets the rollover property of this boolean.

Workaround for Swing UI bug where rollover deactivates itself.

Parameters:
roll - the rollover property
See Also:
setRolloverEnabled(boolean)

setRolloverEnabled

public void setRolloverEnabled(boolean roll)
(non-Javadoc).

Overrides:
setRolloverEnabled in class javax.swing.AbstractButton
See Also:
AbstractButton.setRolloverEnabled(boolean)

setRolloverChangeBackground

public void setRolloverChangeBackground(boolean rollover)
Indicates if background must be changed when mouse is over the button.

Parameters:
rollover - Indicates if the change background mode is activated.

setGrayProp

public void setGrayProp(int grayProp)
Sets the gray proportion of the image used when mouse is not over the button.

Parameters:
grayProp - Indicates the new gray proportion.

setImage

public void setImage(java.awt.Image image)
Sets the image displayed by the button. If the button is in rollover mode, the icon is grayed.

Parameters:
image - the new icon image
See Also:
getImage()

setImage

public void setImage(java.net.URL url,
                     java.awt.Image image)
Sets the image displayed by the button. If the button is in rollover mode, the icon is grayed.
This method must be used when image is animated.

Parameters:
image - the new icon image

getImage

public java.awt.Image getImage()
Gets the image of this button.

Returns:
the image displayed by this button
See Also:
setImage(Image)

setFont

public void setFont(java.awt.Font font)
(non-Javadoc).

Overrides:
setFont in class javax.swing.JComponent
See Also:
Component.setFont(java.awt.Font)

setRepeatEnabled

public void setRepeatEnabled(boolean repeat)
Activates or deactivates repeat mode.

Parameters:
repeat - Indicates if the repeat mode is activated.

setEnvironment

public void setEnvironment(LyEnvironment environment)
Sets the environment of the button.

Parameters:
environment - the environment of the button.

setEnabled

public void setEnabled(boolean b)
(non-Javadoc).

Overrides:
setEnabled in class javax.swing.AbstractButton
See Also:
Component.setEnabled(boolean)

hasFocus

public boolean hasFocus()
(non-Javadoc).

Overrides:
hasFocus in class java.awt.Component
See Also:
Component.hasFocus()

callActionPerformed

public void callActionPerformed(java.awt.event.ActionEvent e)
Performes the specified action. Called when the button has been activated by return.

Parameters:
e - an action event

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
(non-Javadoc).

Specified by:
actionPerformed in interface java.awt.event.ActionListener
See Also:
ActionListener.actionPerformed(java.awt.event.ActionEvent)

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Used to manage the repeat mode.

Specified by:
mousePressed in interface java.awt.event.MouseListener
See Also:
MouseListener.mousePressed(java.awt.event.MouseEvent)

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Used to manage the repeat mode.

Specified by:
mouseReleased in interface java.awt.event.MouseListener
See Also:
MouseListener.mouseReleased(java.awt.event.MouseEvent)

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Used to manage the repeat mode.

Specified by:
mouseClicked in interface java.awt.event.MouseListener
See Also:
MouseListener.mouseClicked(java.awt.event.MouseEvent)

setOpenerButton

public void setOpenerButton(LyJOpenerButton openerButton)
Sets the opener button associated with current one.

Parameters:
openerButton - the new opener button associated with current one.

getInsets

public java.awt.Insets getInsets()
Compacts toobars.

Overrides:
getInsets in class javax.swing.JComponent
Returns:
smaller insets
See Also:
JComponent.getInsets()

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Doesn't do anything.

Specified by:
mouseEntered in interface java.awt.event.MouseListener
See Also:
MouseListener.mouseEntered(java.awt.event.MouseEvent)

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Used to manage the repeat mode.

Specified by:
mouseExited in interface java.awt.event.MouseListener
See Also:
MouseListener.mouseExited(java.awt.event.MouseEvent)

getActionTransmitter

public LyActionTransmitter getActionTransmitter()
(non-Javadoc).

Specified by:
getActionTransmitter in interface LyEventTransmitter
Returns:
the action transmitter of this component
See Also:
LyEventTransmitter.getActionTransmitter()

getSelectionTransmitter

public LySelectionTransmitter getSelectionTransmitter()
This button doesn't handle selection events, so it has no selection transmitter.

Specified by:
getSelectionTransmitter in interface LyEventTransmitter
Returns:
null
See Also:
LyEventTransmitter.getSelectionTransmitter()

getId

public java.lang.String getId()
(non-Javadoc).

Specified by:
getId in interface LyGetIdInterface
See Also:
LyGetIdInterface.getId()

toString

public java.lang.String toString()
Prints the content of this button object.

Overrides:
toString in class java.awt.Component
Returns:
a string representation of this button

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent e)
Generates a warning message on the standard output.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
See Also:
PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)

getToolTipLocation

public java.awt.Point getToolTipLocation(java.awt.event.MouseEvent event)
Deactivate multiple mouse enter on buttons.

Overrides:
getToolTipLocation in class javax.swing.JComponent
See Also:
JComponent.getToolTipLocation(java.awt.event.MouseEvent)

setUI

public void setUI(javax.swing.plaf.ButtonUI ui)
(non-Javadoc).

Overrides:
setUI in class javax.swing.AbstractButton
See Also:
AbstractButton.setUI(javax.swing.plaf.ButtonUI)

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com