Java Code Examples for javax.swing.JToolBar#Separator

The following examples show how to use javax.swing.JToolBar#Separator . 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: ToolBarManager.java    From openAGV with Apache License 2.0 6 votes vote down vote up
public void setOperationMode(OperationMode mode) {
//    toolBarAttributes.setVisible(mode == OperationMode.MODELLING);
    toolBarAlignment.setVisible(mode == OperationMode.MODELLING);
    // Items in Toolbar "Create"
    buttonCreatePoint.setVisible(mode == OperationMode.MODELLING);
    buttonCreateLocation.setVisible(mode == OperationMode.MODELLING);
    buttonCreatePath.setVisible(mode == OperationMode.MODELLING);
    buttonCreateLink.setVisible(mode == OperationMode.MODELLING);
    buttonCreateLocationType.setVisible(mode == OperationMode.MODELLING);
    buttonCreateVehicle.setVisible(mode == OperationMode.MODELLING);
    buttonCreateBlock.setVisible(mode == OperationMode.MODELLING);
    buttonCreateGroup.setVisible(mode == OperationMode.MODELLING);

    for (JToolBar.Separator sep : separatorList) {
      sep.setVisible(mode == OperationMode.MODELLING);
    }

    buttonCreateOrder.setEnabled(mode == OperationMode.OPERATING);
    buttonFindVehicle.setEnabled(mode == OperationMode.OPERATING);
    buttonPauseAllVehicles.setVisible(mode == OperationMode.OPERATING);
  }
 
Example 2
Source File: Toolbar.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Overridden to set focusable to false for any AbstractButton
 * subclasses which are added */
@Override
protected void addImpl(Component c, Object constraints, int idx) {
    //issue 39896, after opening dialog from toolbar button, focus
    //remains on toolbar button.  Does not create an accessibility issue - 
    //all standard toolbar buttons are also available via the keyboard
    if (c instanceof AbstractButton) {
        c.setFocusable(false);
        ((JComponent) c).setOpaque(false);
        if (isMetalLaF) {
            //metal/ocean resets borders, so fix it this way
            ((AbstractButton) c).setBorderPainted(false);
            ((AbstractButton) c).setOpaque(false);
        }
        //This is active for GTK L&F. It should be fixed in JDK
        //but it is not fixed in JDK 6.0.
        if (!isMetalLaF && !isFlatLaF) {
            ((AbstractButton) c).setMargin( emptyInsets );
        }
        if( null != label && c != label ) {
            remove( label );
            label = null;
        }
    } else if( c instanceof JToolBar.Separator ) {
        JToolBar.Separator separator = (JToolBar.Separator)c;
        if (getOrientation() == VERTICAL) {
            separator.setOrientation(JSeparator.HORIZONTAL);
        } else {
            separator.setOrientation(JSeparator.VERTICAL);
        }
    }
    
    super.addImpl (c, constraints, idx);
}
 
Example 3
Source File: ToolbarContainer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public ToolbarAqua() {
    super( new BorderLayout() );
    JSeparator sep = new JToolBar.Separator();
    sep.setOrientation(JSeparator.VERTICAL);
    sep.setForeground(UIManager.getColor("NbSplitPane.background")); //NOI18N
    add( sep, BorderLayout.CENTER );
    dim = new Dimension (GRIP_WIDTH, GRIP_WIDTH);
    max = new Dimension (GRIP_WIDTH, Integer.MAX_VALUE);
    setBorder(BorderFactory.createEmptyBorder(4, 0, 2, 0));
}
 
Example 4
Source File: TransparentToolBar.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
public void addSpace(int width) {
    Dimension dim = horizontal ? new Dimension(width, 0) : new Dimension(0, width);
    JToolBar.Separator separator = new JToolBar.Separator(dim);
    separator.setOrientation(horizontal ? JToolBar.Separator.VERTICAL :
                                          JToolBar.Separator.HORIZONTAL);
    addItem(separator);
}
 
Example 5
Source File: TransparentToolBar.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void addSeparator() {
    JToolBar.Separator separator = new JToolBar.Separator();
    separator.setOrientation(JToolBar.Separator.VERTICAL);
    addItem(separator);
}
 
Example 6
Source File: JComponentBuilders.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected JSeparator createInstanceImpl() {
    return separatorSize == null ? new JToolBar.Separator() :
            new JToolBar.Separator(separatorSize.createInstance());
}
 
Example 7
Source File: ActionManager.java    From audiveris with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Register all actions as listed in the descriptor files, and organize them
 * according to the various domains defined.
 * There is one pull-down menu generated for each domain found.
 */
public void registerAllActions ()
{
    // Insert an initial separator, to let user easily grab the toolBar
    toolBar.addSeparator();

    DomainLoop:
    for (String domain : Actions.getDomainNames()) {
        // Create dedicated menu for this range, if not already existing
        JMenu menu = menuMap.get(domain);

        if (menu == null) {
            logger.debug("Creating menu:{}", domain);
            menu = new SeparableMenu(domain);
            menuMap.put(domain, menu);
        } else {
            logger.debug("Augmenting menu:{}", domain);
        }

        // Proper menu decoration
        ResourceMap resource = OmrGui.getApplication().getContext().getResourceMap(
                Actions.class);
        menu.setText(domain); // As default
        menu.setName(domain);

        // Register all actions in the given domain
        registerDomainActions(domain, menu);
        resource.injectComponents(menu); // Localized

        SeparableMenu.trimSeparator(menu); // No separator at end of menu

        // Smart insertion of the menu into the menu bar, and separators into the toolBar
        if (menu.getItemCount() > 0) {
            final int toolCount = toolBar.getComponentCount();

            if (toolCount > 0) {
                Component comp = toolBar.getComponent(toolCount - 1);

                if (!(comp instanceof JToolBar.Separator)) {
                    toolBar.addSeparator();
                }
            }

            menuBar.add(menu);
        }
    }
}
 
Example 8
Source File: TransparentToolBar.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
public void addSeparator() {
    JToolBar.Separator separator = new JToolBar.Separator();
    separator.setOrientation(JToolBar.Separator.VERTICAL);
    addItem(separator);
}
 
Example 9
Source File: JComponentBuilders.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
protected JSeparator createInstanceImpl() {
    return separatorSize == null ? new JToolBar.Separator() :
            new JToolBar.Separator(separatorSize.createInstance());
}
 
Example 10
Source File: TransparentToolBar.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
public void addSeparator() {
    JToolBar.Separator separator = new JToolBar.Separator();
    separator.setOrientation(horizontal ? JToolBar.Separator.VERTICAL :
                                          JToolBar.Separator.HORIZONTAL);
    addItem(separator);
}
 
Example 11
Source File: ExtensionReveal.java    From zap-extensions with Apache License 2.0 4 votes vote down vote up
private JToolBar.Separator getToolBarSeparator() {
    if (toolBarSeparator == null) {
        toolBarSeparator = new JToolBar.Separator();
    }
    return toolBarSeparator;
}
 
Example 12
Source File: ExtensionZest.java    From zap-extensions with Apache License 2.0 4 votes vote down vote up
private JToolBar.Separator getToolbarSeparator() {
    if (toolbarSeparator == null) {
        toolbarSeparator = new JToolBar.Separator();
    }
    return toolbarSeparator;
}