Example usage for javax.swing AbstractButton setFocusable

List of usage examples for javax.swing AbstractButton setFocusable

Introduction

In this page you can find the example usage for javax.swing AbstractButton setFocusable.

Prototype

public void setFocusable(boolean focusable) 

Source Link

Document

Sets the focusable state of this Component to the specified value.

Usage

From source file:com.mightypocket.ashot.Mediator.java

private JToolBar createToolBar() {
    ApplicationActionMap actionMap = getActionMap();
    JToolBar bar = new JToolBar();
    bar.setRollover(true);/*from  w  w  w .j a v a 2  s .  co m*/
    toolBarMap.clear();
    final boolean hideText = !p.getBoolean(PREF_GUI_SHOW_TEXT_IN_TOOLBAR, true);
    for (String actionName : TOOLBAR) {
        if (TOOLBAR_SEPARATOR.equals(actionName)) {
            bar.addSeparator();
        } else {
            AbstractButton bt;
            if (actionName.startsWith(TOOLBAR_TOGGLE_BUTTON)) {
                actionName = StringUtils.substring(actionName, TOOLBAR_TOGGLE_BUTTON.length());
                bt = new JToggleButton(actionMap.get(actionName));
            } else {
                bt = new JButton(actionMap.get(actionName));
            }
            bt.setFocusable(false);
            bt.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
            bt.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
            bt.setHideActionText(hideText);
            bar.add(bt);
            toolBarMap.put(actionName, bt);
        }
    }

    return bar;
}

From source file:SoundManagerTest.java

/**
 * Creates a button (either JButton or JToggleButton).
 *///from   w w w.  ja va 2s  .  c  om
public AbstractButton createButton(String name, boolean canToggle) {
    AbstractButton button;

    if (canToggle) {
        button = new JToggleButton(name);
    } else {
        button = new JButton(name);
    }
    button.addActionListener(this);
    button.setIgnoreRepaint(true);
    button.setFocusable(false);

    return button;
}

From source file:org.zeromeaner.gui.reskin.StandaloneFrame.java

private static void add(JToolBar toolbar, ButtonGroup g, AbstractButton b) {
    b.setFocusable(false);
    b.setBorder(null);/* w  ww  . jav a2s.  c  o  m*/
    b.setHorizontalAlignment(SwingConstants.LEFT);
    toolbar.add(b);
    if (g != null)
        g.add(b);
}