jaxx.runtime.swing
Class BlockingLayerUI2

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by org.jdesktop.jxlayer.plaf.LayerUI<V>
          extended by org.jdesktop.jxlayer.plaf.AbstractLayerUI<JComponent>
              extended by 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 :

Since:
1.3
Author:
tchemit
See Also:
Serialized Form

Field Summary
static String ACCEPT_ICON_PROPERTY
           
protected  Action acceptAction
          Action to be treated when click on icon
protected  BufferedImage acceptIcon
          Icon when you can click
static String BLOCK_ICON_PROPERTY
           
protected  BufferedImage blockIcon
          Icon when you can not click
protected  Color blockingColor
          Optinal color to put fill background when blocking
static String CAN_CLICK_PROPERTY
           
protected  boolean canClick
          Internal state to known when we can accept click
 
Constructor Summary
BlockingLayerUI2()
           
 
Method Summary
protected  void acceptEvent(MouseEvent e, org.jdesktop.jxlayer.JXLayer<? extends JComponent> l)
           
 BlockingLayerUI2 clone()
           
protected  BufferedImage getAcceptIcon()
           
 BufferedImage getBlockIcon()
           
protected  BufferedImage getCurrentIcon()
           
 boolean isCanClick()
           
protected  void paintLayer(Graphics2D g2, org.jdesktop.jxlayer.JXLayer<? extends JComponent> l)
           
protected  BufferedImage prepareIcon(ImageIcon image)
           
protected  void processKeyEvent(KeyEvent e, org.jdesktop.jxlayer.JXLayer<? extends JComponent> l)
           
protected  void processMouseEvent(MouseEvent e, org.jdesktop.jxlayer.JXLayer<? extends JComponent> l)
           
protected  void processMouseMotionEvent(MouseEvent e, org.jdesktop.jxlayer.JXLayer<? extends JComponent> l)
           
 void setAcceptAction(Action acceptAction)
           
 void setAcceptIcon(ImageIcon acceptIcon)
           
 void setBlockIcon(BufferedImage blockIcon)
           
 void setBlockIcon(ImageIcon blockIcon)
           
 void setBlockingColor(Color blockingColor)
           
 void setCanClick(boolean canClick)
           
 void setDirty(boolean isDirty)
           
protected  void updateCanClickState(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, processMouseWheelEvent, uninstallUI
 
Methods inherited from class org.jdesktop.jxlayer.plaf.LayerUI
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, getPreferredScrollableViewportSize, getPropertyChangeListeners, getPropertyChangeListeners, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, removePropertyChangeListener, removePropertyChangeListener, updateUI
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, createUI, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize, update
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

Constructor Detail

BlockingLayerUI2

public BlockingLayerUI2()
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:
setDirty in class org.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()
Overrides:
clone in class Object

processKeyEvent

protected void processKeyEvent(KeyEvent e,
                               org.jdesktop.jxlayer.JXLayer<? extends JComponent> l)
Overrides:
processKeyEvent in class org.jdesktop.jxlayer.plaf.AbstractLayerUI<JComponent>

processMouseMotionEvent

protected void processMouseMotionEvent(MouseEvent e,
                                       org.jdesktop.jxlayer.JXLayer<? extends JComponent> l)
Overrides:
processMouseMotionEvent in class org.jdesktop.jxlayer.plaf.AbstractLayerUI<JComponent>

processMouseEvent

protected void processMouseEvent(MouseEvent e,
                                 org.jdesktop.jxlayer.JXLayer<? extends JComponent> l)
Overrides:
processMouseEvent in class org.jdesktop.jxlayer.plaf.AbstractLayerUI<JComponent>

paintLayer

protected void paintLayer(Graphics2D g2,
                          org.jdesktop.jxlayer.JXLayer<? extends JComponent> l)
Overrides:
paintLayer in class org.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)


Copyright © 2008-2012 CodeLutin. All Rights Reserved.