Java Utililty Methods JToolBar

List of utility methods to do JToolBar

  1. HOME
  2. Java
  3. J
  4. JToolBar

Description

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

Method

JButton addButton(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) {
...
JButton addButton(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()));
...
JRadioButton addRadioButton(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;
void addToolbar(JPanel panel, JToolBar bar)
add Toolbar
panel.add(bar, BorderLayout.PAGE_START);
JButton addToolBarButton(JToolBar toolbar, Action action, String tooltip, Icon icon)
Add an action to the toolbar.
return addToolBarButton(toolbar, action, tooltip, icon, null, true);
JButton addToolBarButton(JToolBar toolbar, Action action, String tooltip, Icon icon, String lbl)
Add an action to the toolbar.
return addToolBarButton(toolbar, action, tooltip, icon, lbl, true);
void addToolItems(JToolBar toolBar, JComponent... items)
add Tool Items
for (JComponent item : items) {
 if (item == null) {
 toolBar.addSeparator();
 } else {
 toolBar.add(item);
void buildToolbar(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);
...
JToolBar createDefaultToolBar()
create Default Tool Bar
JToolBar toolbar = new JToolBar();
toolbar.setFloatable(false);
toolbar.setRollover(true);
return toolbar;
JToolBar createToolBar()
create Tool Bar
JToolBar tb = new JToolBar();
tb.setFloatable(false);
tb.setRollover(true);
tb.setBorder(BorderFactory.createEmptyBorder(1, 0, 0, 0));
return tb;


AltStyle によって変換されたページ (->オリジナル) /