Java Code Examples for javax.swing.JToolBar#setFocusable()

The following examples show how to use javax.swing.JToolBar#setFocusable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HierarchyTopComponent.java    From netbeans with Apache License 2.0 6 votes vote down vote up
MainToolBar(@NonNull final Pair<JComponent,GridBagConstraints>... components) {
    super(BoxLayout.X_AXIS);
    setBorder(BorderFactory.createEmptyBorder(1, 2, 1, 5));
    final JToolBar toolbar = new NoBorderToolBar(JToolBar.HORIZONTAL);
    toolbar.setFloatable(false);
    toolbar.setRollover(true);
    toolbar.setBorderPainted(false);
    toolbar.setBorder(BorderFactory.createEmptyBorder());
    toolbar.setOpaque(false);
    toolbar.setFocusable(false);
    toolbar.setLayout(new GridBagLayout());
    for (Pair<JComponent,GridBagConstraints> p : components) {
        toolbar.add(p.first(),p.second());
    }
    add (toolbar);
}
 
Example 2
Source File: DropdownButton.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public DropdownButton(String text, Icon icon, boolean toolbar) {
    setOpaque(false);
    
    if (toolbar) {
        JToolBar tb = new GenericToolbar() {
            public void doLayout() {
                for (Component c : getComponents())
                    c.setBounds(0, 0, getWidth(), getHeight());
            }
            public void paint(Graphics g) {
                paintChildren(g);
            }
        };
        tb.setFloatable(false);
        tb.setFocusable(false);
        container = tb;
        add(container);
    } else {
        container = this;
    }
    
    button = new Button(text, icon);
    container.add(button);
    
    popup = new Popup();
    container.add(popup);
    
    KeyStroke down = KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0);
    container.getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(down, POPUP_ACTION);
    container.getActionMap().put(POPUP_ACTION, new AbstractAction() {
        public void actionPerformed(ActionEvent e) { displayPopup(); }
    });
}
 
Example 3
Source File: StatisticsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
     */
    private JComponent createToolbar() {
        createShowButtons();
        createNextPrevFailureButtons();
        createRerunButtons();
	createOptionButtons();
        String testingFramework = Manager.getInstance().getTestingFramework();

        JToolBar toolbar = new ToolbarWithOverflow(SwingConstants.VERTICAL);
        toolbar.add(rerunButton);
        toolbar.add(rerunFailedButton);
        toolbar.add(new JToolBar.Separator());
        toolbar.add(btnShowPassed);
        if(testingFramework.equals(Manager.TESTNG_TF)) {
            toolbar.add(btnShowPassedWithErrors);
        }
        toolbar.add(btnShowFailed);
        toolbar.add(btnShowError);
        toolbar.add(btnShowAborted);
//        if(testingFramework.equals(Manager.TESTNG_TF) || testingFramework.equals(Manager.JUNIT_TF)) {
//            toolbar.add(btnShowIgnored);
//        }
        toolbar.add(btnShowSkipped);
	
        toolbar.add(new JToolBar.Separator());
        toolbar.add(previousFailure);
        toolbar.add(nextFailure);
        toolbar.add(new JToolBar.Separator());
        toolbar.add(btnAlwaysOpenTRW);
	toolbar.add(btnAlwaysOpenNewTab);
        
        toolbar.setFocusable(false);
        toolbar.setRollover(true);
        toolbar.setFloatable(false);
        return toolbar;
    }
 
Example 4
Source File: DropdownButton.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
public DropdownButton(String text, Icon icon, boolean toolbar) {
    setOpaque(false);
    
    if (toolbar) {
        JToolBar tb = new GenericToolbar() {
            public void doLayout() {
                for (Component c : getComponents())
                    c.setBounds(0, 0, getWidth(), getHeight());
            }
            public void paint(Graphics g) {
                paintChildren(g);
            }
        };
        tb.setFloatable(false);
        tb.setFocusable(false);
        container = tb;
        add(container);
    } else {
        container = this;
    }
    
    button = new Button(text, icon);
    container.add(button);
    
    popup = new Popup();
    container.add(popup);
    
    KeyStroke down = KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0);
    container.getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(down, POPUP_ACTION);
    container.getActionMap().put(POPUP_ACTION, new AbstractAction() {
        public void actionPerformed(ActionEvent e) { displayPopup(); }
    });
}