Package swingtree

Class UI.Menu

All Implemented Interfaces:
ImageObserver, ItemSelectable, MenuContainer, Serializable, Accessible, MenuElement, SwingConstants, StylableComponent
Enclosing class:
UI

public static class UI.Menu extends JMenu implements StylableComponent
{inheritDoc}
See Also:
  • Constructor Details

    • Menu

      public Menu()
  • Method Details

    • paint

      public void paint(Graphics g)
      Description copied from interface: StylableComponent
      This method is expected to be implemented as follows within a component extension which ought to be made compatible with SwingTree.
            @Override
            public void paint(Graphics g){
                paintBackground(g, ()->super.paint(g));
            }
        
      Specified by:
      paint in interface StylableComponent
      Overrides:
      paint in class JComponent
      Parameters:
      g - the graphics context to paint on, obtained from the component's JComponent.paint(Graphics) method.
    • paintChildren

      public void paintChildren(Graphics g)
      Description copied from interface: StylableComponent
      This method is expected to be implemented as follows:
            @Override
            public void paintChildren(Graphics g){
                paintForeground(g, ()->super.paintChildren(g));
            }
        
      Specified by:
      paintChildren in interface StylableComponent
      Overrides:
      paintChildren in class JComponent
      Parameters:
      g - the graphics context to paint on, obtained from the component's JComponent::paintChildren(Graphics) method.
    • setUISilently

      public void setUISilently(ComponentUI ui)
      Description copied from interface: StylableComponent
      Certain style configurations require SwingTree to install a custom UI delegate. This method is used to set the UI delegate for the component but without triggering side effects like the former UI being uninstalled (which itself can cause a lot of undesired side effects).

      This method is not intended to be called by client code! It exists for internal use only and unfortunately cannot be protected or private due to the nature of the Swing API.

      The implementation of this method is expected to look like this:

        @Override
        public void setUISilently(ComponentUI ui){
            this.ui = ui; // no side effects
        }
        
      Specified by:
      setUISilently in interface StylableComponent
      Parameters:
      ui - the UI delegate to set for the component without triggering side effects.