Package org.nuiton.jaxx.runtime.swing
Class BlockingLayerUI2
- java.lang.Object
-
- javax.swing.plaf.ComponentUI
-
- org.jdesktop.jxlayer.plaf.LayerUI<V>
-
- org.jdesktop.jxlayer.plaf.AbstractLayerUI<JComponent>
-
- org.nuiton.jaxx.runtime.swing.BlockingLayerUI2
-
- All Implemented Interfaces:
Serializable
public class BlockingLayerUI2 extends org.jdesktop.jxlayer.plaf.AbstractLayerUI<JComponent>
A JXLayer ui implementation that permits to block a component but still allow an action when clicking everywhere on the layer. Moreover, an icon can be added on the right-top icon painted and changed when the mouse is over the layer. You can change the blocking and accepting icon. To hook an click on the layer's icon, you can :- pass an Action via method
setAcceptAction(Action) - override the method
acceptEvent(MouseEvent, JXLayer)
- Since:
- 1.3
- Author:
- Tony Chemit - dev@tchemit.fr
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringACCEPT_ICON_PROPERTYprotected ActionacceptActionAction to be treated when click on iconprotected BufferedImageacceptIconIcon when you can clickstatic StringBLOCK_ICON_PROPERTYprotected BufferedImageblockIconIcon when you can not clickprotected ColorblockingColorOptinal color to put fill background when blockingstatic StringCAN_CLICK_PROPERTYprotected booleancanClickInternal state to known when we can accept click
-
Constructor Summary
Constructors Constructor Description BlockingLayerUI2()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidacceptEvent(MouseEvent e, org.jdesktop.jxlayer.JXLayer<? extends JComponent> l)BlockingLayerUI2clone()protected BufferedImagegetAcceptIcon()BufferedImagegetBlockIcon()protected BufferedImagegetCurrentIcon()booleanisCanClick()protected voidpaintLayer(Graphics2D g2, org.jdesktop.jxlayer.JXLayer<? extends JComponent> l)protected BufferedImageprepareIcon(ImageIcon image)protected voidprocessKeyEvent(KeyEvent e, org.jdesktop.jxlayer.JXLayer<? extends JComponent> l)protected voidprocessMouseEvent(MouseEvent e, org.jdesktop.jxlayer.JXLayer<? extends JComponent> l)protected voidprocessMouseMotionEvent(MouseEvent e, org.jdesktop.jxlayer.JXLayer<? extends JComponent> l)protected voidprocessMouseWheelEvent(MouseWheelEvent e, org.jdesktop.jxlayer.JXLayer<? extends JComponent> l)voidsetAcceptAction(Action acceptAction)voidsetAcceptIcon(ImageIcon acceptIcon)voidsetBlockIcon(BufferedImage blockIcon)voidsetBlockIcon(ImageIcon blockIcon)voidsetBlockingColor(Color blockingColor)voidsetCanClick(boolean canClick)voidsetDirty(boolean isDirty)protected voidupdateCanClickState(org.jdesktop.jxlayer.JXLayer<JComponent> l, MouseEvent e)-
Methods inherited from class org.jdesktop.jxlayer.plaf.AbstractLayerUI
configureGraphics, eventDispatched, getClip, getComposite, getLayerEventMask, getRenderingHints, getTransform, handlePropertyChangeEvent, installUI, isDirty, paint, processFocusEvent, uninstallUI
-
Methods inherited from class javax.swing.plaf.ComponentUI
contains, createUI, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize, update
-
Methods inherited from class org.jdesktop.jxlayer.plaf.LayerUI
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, getPreferredScrollableViewportSize, getPropertyChangeListeners, getPropertyChangeListeners, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, removePropertyChangeListener, removePropertyChangeListener, updateUI
-
-
-
-
Field Detail
-
CAN_CLICK_PROPERTY
public static final String CAN_CLICK_PROPERTY
- See Also:
- Constant Field Values
-
ACCEPT_ICON_PROPERTY
public static final String ACCEPT_ICON_PROPERTY
- See Also:
- Constant Field Values
-
BLOCK_ICON_PROPERTY
public static final String BLOCK_ICON_PROPERTY
- See Also:
- Constant Field Values
-
acceptAction
protected Action acceptAction
Action to be treated when click on icon
-
blockIcon
protected BufferedImage blockIcon
Icon when you can not click
-
acceptIcon
protected BufferedImage acceptIcon
Icon when you can click
-
blockingColor
protected Color blockingColor
Optinal color to put fill background when blocking
-
canClick
protected boolean canClick
Internal state to known when we can accept click
-
-
Method Detail
-
setAcceptAction
public void setAcceptAction(Action acceptAction)
-
setAcceptIcon
public void setAcceptIcon(ImageIcon acceptIcon)
-
setBlockIcon
public void setBlockIcon(ImageIcon blockIcon)
-
setCanClick
public void setCanClick(boolean canClick)
-
setDirty
public void setDirty(boolean isDirty)
- Overrides:
setDirtyin classorg.jdesktop.jxlayer.plaf.AbstractLayerUI<JComponent>
-
setBlockingColor
public void setBlockingColor(Color blockingColor)
-
setBlockIcon
public void setBlockIcon(BufferedImage blockIcon)
-
getBlockIcon
public BufferedImage getBlockIcon()
-
getAcceptIcon
protected BufferedImage getAcceptIcon()
-
isCanClick
public boolean isCanClick()
-
clone
public BlockingLayerUI2 clone() throws CloneNotSupportedException
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
processKeyEvent
protected void processKeyEvent(KeyEvent e, org.jdesktop.jxlayer.JXLayer<? extends JComponent> l)
- Overrides:
processKeyEventin classorg.jdesktop.jxlayer.plaf.AbstractLayerUI<JComponent>
-
processMouseMotionEvent
protected void processMouseMotionEvent(MouseEvent e, org.jdesktop.jxlayer.JXLayer<? extends JComponent> l)
- Overrides:
processMouseMotionEventin classorg.jdesktop.jxlayer.plaf.AbstractLayerUI<JComponent>
-
processMouseWheelEvent
protected void processMouseWheelEvent(MouseWheelEvent e, org.jdesktop.jxlayer.JXLayer<? extends JComponent> l)
- Overrides:
processMouseWheelEventin classorg.jdesktop.jxlayer.plaf.AbstractLayerUI<JComponent>
-
processMouseEvent
protected void processMouseEvent(MouseEvent e, org.jdesktop.jxlayer.JXLayer<? extends JComponent> l)
- Overrides:
processMouseEventin classorg.jdesktop.jxlayer.plaf.AbstractLayerUI<JComponent>
-
paintLayer
protected void paintLayer(Graphics2D g2, org.jdesktop.jxlayer.JXLayer<? extends JComponent> l)
- Overrides:
paintLayerin classorg.jdesktop.jxlayer.plaf.AbstractLayerUI<JComponent>
-
acceptEvent
protected void acceptEvent(MouseEvent e, org.jdesktop.jxlayer.JXLayer<? extends JComponent> l)
-
getCurrentIcon
protected BufferedImage getCurrentIcon()
-
prepareIcon
protected BufferedImage prepareIcon(ImageIcon image)
-
updateCanClickState
protected void updateCanClickState(org.jdesktop.jxlayer.JXLayer<JComponent> l, MouseEvent e)
-
-