Class JToolBar

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, SwingConstants

public class JToolBar extends JComponent implements SwingConstants, Accessible
Emulator for JToolBar. See D_jtoolbar.
See Also:
  • Constructor Details

    • JToolBar

      public JToolBar()
    • JToolBar

      public JToolBar(int orientation)
    • JToolBar

      public JToolBar(String name)
    • JToolBar

      public JToolBar(String name, int orientation)
      Throws:
      IllegalArgumentException - if orientation is neither HORIZONTAL nor VERTICAL, as in the JDK
  • Method Details

    • defaultFillCssClass

      protected String defaultFillCssClass()
      Chrome tint rather than the flat surface fill the Div peer would otherwise select. A Swing tool bar reads as raised against the window it sits in, not as part of the page — measured in a browser, the base token is invisible here because it is the same colour as the content behind it, where the container token renders the strip a migrated app expects (D_theme_is_lookandfeel).
      Overrides:
      defaultFillCssClass in class Component
    • getComponentIndex

      public int getComponentIndex(Component c)
      Separators occupy index positions, as in the JDK.
    • getComponentAtIndex

      public Component getComponentAtIndex(int i)
      Returns:
      the child at i, or null for an invalid index — the JDK does not throw
    • setMargin

      public void setMargin(Insets m)
      Rendered as CSS padding on the peer; null removes it. Unguarded, as the JDK's is, so a repeated null still fires.
    • getMargin

      public Insets getMargin()
      Returns:
      the margin as set, or a fresh zero Insets while none is
    • isBorderPainted

      public boolean isBorderPainted()
    • setBorderPainted

      public void setBorderPainted(boolean b)
      Stored and fired; the effect is declined — the CSS border installed through JComponent.setBorder(Border) paints either way.
    • isFloatable

      public boolean isFloatable()
    • setFloatable

      public void setFloatable(boolean b)
      Stored and fired; the effect is declined — a browser has no detachable toolbars.
    • getOrientation

      public int getOrientation()
    • setOrientation

      public void setOrientation(int o)
      Also turns every JToolBar.Separator child perpendicular to the new orientation, as the L&F's listener does on the desktop.
      Throws:
      IllegalArgumentException - if o is neither HORIZONTAL nor VERTICAL, even when unchanged — the JDK checks first
    • setRollover

      public void setRollover(boolean rollover)
      Stored under "JToolBar.isRollover" in the client-property table, where the JDK puts it, so the "JToolBar.isRollover" PropertyChangeEvent is JComponent.putClientProperty(Object, Object)'s — which is why its old value is null on the first call and why the values are boxed (D_property_fanout_audit). The effect is declined: Vaadin buttons paint their own hover state.
    • isRollover

      public boolean isRollover()
    • addSeparator

      public void addSeparator()
      Appends a JToolBar.Separator of the default size.
    • addSeparator

      public void addSeparator(Dimension size)
      Appends a JToolBar.Separator. The size is stored on it but not rendered (R_layouts_close_enough): every separator paints as the same thin bar.
    • add

      public JButton add(Action a)
    • createActionComponent

      protected JButton createActionComponent(Action a)
      The button add(javax.swing.Action) wraps an Action in: its text is hidden when the Action carries an icon, and its Action listener comes from createActionChangeListener(JButton) when that returns one.
    • createActionChangeListener

      protected PropertyChangeListener createActionChangeListener(JButton b)
      Returns:
      null, which keeps the button's default Action listener
    • addImpl

      protected void addImpl(Component comp, Object constraints, int index)
      Turns a JToolBar.Separator perpendicular to this toolbar and makes a JButton non-default-capable, then adds as usual.
      Overrides:
      addImpl in class Container
    • getUIClassID

      public String getUIClassID()
      Overrides:
      getUIClassID in class JComponent
    • updateUI

      public void updateUI()
      Overrides:
      updateUI in class JComponent
    • getUI

      public ToolBarUI getUI()
      Overrides:
      getUI in class JComponent
    • setUI

      public void setUI(ToolBarUI ui)
    • getAccessibleContext

      public AccessibleContext getAccessibleContext()
      Specified by:
      getAccessibleContext in interface Accessible
      Overrides:
      getAccessibleContext in class Component
    • paramString

      protected String paramString()
      Overrides:
      paramString in class JComponent