List of utility methods to do JToolBar
JToolBar | createToolbar() create Toolbar JToolBar toolbar = new JToolBar(); toolbar.setFloatable(false); JButton button = null; button = makeNavigationButton(CLOSE, "Close the expression window", "Close Window"); toolbar.add(button); button = makeNavigationButton(EXIT, "Exit the program", "Exit Program"); toolbar.add(button); return toolbar; ... |
void | fixButton(AbstractButton button, String toolTip) fix Button button.setFocusable(false); button.setMargin(ZERO_INSETS); button.setToolTipText(toolTip); |
void | floatToolBar(JToolBar tb, Point p) float Tool Bar ToolBarUI tbUI = tb.getUI(); if (tbUI instanceof BasicToolBarUI) ((BasicToolBarUI) tbUI).setFloating(false, p); |
void | formatToolBar(JToolBar toolbar, int style) format Tool Bar Component[] comps = toolbar.getComponents(); for (int count = 0; count < comps.length; count++) { if (comps[count] instanceof AbstractButton) { if (style == ICON_ONLY) { ((AbstractButton) comps[count]).setText(null); } else if (style == TEXT_ONLY) { ((AbstractButton) comps[count]).setIcon(null); |
AbstractButton | getToolbarButton(JToolBar toolbar, Action action) Find the JButton in the toolbar that is associated with the provided action return getMenuItem(toolbar, action);
|
JComponent | getToolBarFill(int orientation) get Tool Bar Fill Dimension dim = null; if (orientation == SwingConstants.HORIZONTAL) { dim = new Dimension(2, 1); } else { dim = new Dimension(1, 2); return new Box.Filler(dim, dim, dim); |
int | getToolbarOrientation(String location) Returns a toolbar orientation based on its location. return (location.equalsIgnoreCase(BorderLayout.NORTH) || location.equalsIgnoreCase(BorderLayout.SOUTH))
? JToolBar.HORIZONTAL
: JToolBar.VERTICAL;
|
void | hideChildButtonsWithTooltip(Container parent, String tooltip) Find button by tooltip for (Component component : parent.getComponents()) { if (component instanceof AbstractButton && tooltip.equals(((AbstractButton) component).getToolTipText())) { component.setVisible(false); } else if (component instanceof Container) { hideChildButtonsWithTooltip((Container) component, tooltip); |
void | initIconButton(AbstractButton button, String toolTip) Inits the icon button. button.setBorderPainted(false); button.setContentAreaFilled(false); button.setToolTipText(toolTip); |
boolean | isToolBarButton(JComponent c) is Tool Bar Button return (c.getParent() instanceof JToolBar); |