/** * Sets whether the overflow should be displayed on hover or not. The * default value is <code>true</code>. * * @param displayOverflowOnHover if <code>true</code>, the overflow will be displayed on hover; * <code>false</code> otherwise */ public void setDisplayOverflowOnHover(boolean displayOverflowOnHover) { this.displayOverflowOnHover = displayOverflowOnHover; setupOverflowButton(); }
@Override public void setOrientation(int o) { super.setOrientation(o); setupOverflowButton(); }
/** * Creates a new tool bar with a specified * <code>name</code> and * <code>orientation</code>. All other constructors call this constructor. * If * <code>orientation</code> is an invalid value, an exception will be * thrown. * * @param name the name of the tool bar * @param orientation the initial orientation -- it must be * either <code>HORIZONTAL</code> or <code>VERTICAL</code> * @exception IllegalArgumentException if orientation is neither * <code>HORIZONTAL</code> nor <code>VERTICAL</code> */ public ToolbarWithOverflow(String name, int orientation) { super(name, orientation); setupOverflowButton(); popup = new JPopupMenu(); popup.setBorderPainted(false); popup.setBorder(BorderFactory.createEmptyBorder()); overflowToolbar = new JToolBar("overflowToolbar", orientation == HORIZONTAL ? VERTICAL : HORIZONTAL); overflowToolbar.setFloatable(false); overflowToolbar.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1)); }