Java Utililty Methods JToolBar

List of utility methods to do JToolBar

Description

The list of methods to do JToolBar are organized into topic(s).

Method

JButtonaddButton(Container component, String text, Icon icon, ActionListener listener, String actionCommand, int mnemonic, String toolTip)
Add a new button to a given component
JButton button = new JButton(text, icon);
if (listener != null) {
    button.addActionListener(listener);
if (actionCommand != null) {
    button.setActionCommand(actionCommand);
if (mnemonic > 0) {
...
JButtonaddButton(Container container, String label, int mnemonic, String tooltip, String placement, boolean debug)
Add a button
JButton button = new JButton(label);
button.setMnemonic(mnemonic);
button.setToolTipText(tooltip);
button.setOpaque(!getIsMac());
container.add(button, placement);
if (debug == true)
    button.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.red),
            button.getBorder()));
...
JRadioButtonaddRadioButton(Container container, String label, int mnemonic, String tooltip, String placement, boolean debug)
Add a radio button (with label) to parent container
JRadioButton button = new JRadioButton(label);
button.setToolTipText(tooltip);
container.add(button, placement);
button.setOpaque(false);
return button;
voidaddToolbar(JPanel panel, JToolBar bar)
add Toolbar
panel.add(bar, BorderLayout.PAGE_START);
JButtonaddToolBarButton(JToolBar toolbar, Action action, String tooltip, Icon icon)
Add an action to the toolbar.
return addToolBarButton(toolbar, action, tooltip, icon, null, true);
JButtonaddToolBarButton(JToolBar toolbar, Action action, String tooltip, Icon icon, String lbl)
Add an action to the toolbar.
return addToolBarButton(toolbar, action, tooltip, icon, lbl, true);
voidaddToolItems(JToolBar toolBar, JComponent... items)
add Tool Items
for (JComponent item : items) {
    if (item == null) {
        toolBar.addSeparator();
    } else {
        toolBar.add(item);
voidbuildToolbar(final JToolBar toolbar, final List components)
Add a List of Components to the specified JToolBar.
if ((toolbar != null) && (components != null) && (!components.isEmpty())) {
    final Iterator<Component> iterComponents;
    iterComponents = components.iterator();
    while (iterComponents.hasNext()) {
        final Component component;
        component = iterComponents.next();
        if (component != null) {
            toolbar.add(component);
...
JToolBarcreateDefaultToolBar()
create Default Tool Bar
JToolBar toolbar = new JToolBar();
toolbar.setFloatable(false);
toolbar.setRollover(true);
return toolbar;
JToolBarcreateToolBar()
create Tool Bar
JToolBar tb = new JToolBar();
tb.setFloatable(false);
tb.setRollover(true);
tb.setBorder(BorderFactory.createEmptyBorder(1, 0, 0, 0));
return tb;