Class BlockingLayerUI

  • All Implemented Interfaces:
    Serializable

    public class BlockingLayerUI
    extends org.jdesktop.jxlayer.plaf.AbstractLayerUI<JComponent>
    A JXLayer ui implementation that permits to block a component but still allow an action when clicking on the right-top icon painted on the layer. You can change the blocking and accepting icon. To hook an click on the layer's icon, you can :
    Since:
    1.2
    Author:
    Tony Chemit - dev@tchemit.fr
    See Also:
    Serialized Form
    • Field Detail

      • 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
      • useIcon

        protected boolean useIcon
        A flag to enable or disable the use of the icon. If set to false, no icon will be displayed and no action will be possible. By default, this is active.
      • block

        protected boolean block
        Internal state when should block event and paint layer
      • acceptedComponentNames

        protected final Set<String> acceptedComponentNames
        Extra components names to accept even in block mode
      • acceptedComponentTypes

        protected final Set<Class<?>> acceptedComponentTypes
        Extra components types to accept even in block mode
    • Constructor Detail

      • BlockingLayerUI

        public BlockingLayerUI()
    • Method Detail

      • isBlock

        public boolean isBlock()
      • setAcceptedComponentNames

        public void setAcceptedComponentNames​(String... acceptedComponentNames)
      • setAcceptedComponentTypes

        public void setAcceptedComponentTypes​(Class<?>... acceptedComponentTypes)
      • setAcceptAction

        public void setAcceptAction​(Action acceptAction)
      • setAcceptIcon

        public void setAcceptIcon​(ImageIcon acceptIcon)
      • setBlockIcon

        public void setBlockIcon​(ImageIcon blockIcon)
      • setCanClick

        public void setCanClick​(boolean canClick)
      • setBlock

        public void setBlock​(boolean block)
      • setDirty

        public void setDirty​(boolean isDirty)
        Overrides:
        setDirty in class org.jdesktop.jxlayer.plaf.AbstractLayerUI<JComponent>
      • setBlockIcon

        public void setBlockIcon​(BufferedImage blockIcon)
      • setBlockingColor

        public void setBlockingColor​(Color blockingColor)
      • isCanClick

        public boolean isCanClick()
      • setUseIcon

        public void setUseIcon​(boolean useIcon)
      • 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>
      • processMouseWheelEvent

        protected void processMouseWheelEvent​(MouseWheelEvent e,
                                              org.jdesktop.jxlayer.JXLayer<? extends JComponent> l)
        Overrides:
        processMouseWheelEvent in class org.jdesktop.jxlayer.plaf.AbstractLayerUI<JComponent>
      • acceptEventOrConsumeIt

        protected boolean acceptEventOrConsumeIt​(InputEvent e)
      • acceptEventOrConsumeIt

        public boolean acceptEventOrConsumeIt​(ActionEvent e)
      • 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)
      • updateCanClickState

        protected void updateCanClickState​(org.jdesktop.jxlayer.JXLayer<? extends JComponent> l,
                                           MouseEvent e)