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

The following examples show how to use javax.swing.JToolBar#setBackground() . 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: ViewComponent.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void initComponents() {
    setLayout (new BorderLayout ());
    contentComponent = new javax.swing.JPanel(new BorderLayout ());
    add (contentComponent, BorderLayout.CENTER);  //NOI18N
    JToolBar toolBar = new JToolBar(JToolBar.VERTICAL);
    toolBar.setFloatable(false);
    toolBar.setRollover(true);
    toolBar.setBorderPainted(true);
    if( "Aqua".equals(UIManager.getLookAndFeel().getID()) ) { //NOI18N
        toolBar.setBackground(UIManager.getColor("NbExplorerView.background")); //NOI18N
    }
    toolBar.setBorder(javax.swing.BorderFactory.createCompoundBorder(
            javax.swing.BorderFactory.createMatteBorder(0, 0, 0, 1,
            javax.swing.UIManager.getDefaults().getColor("Separator.background")),
            javax.swing.BorderFactory.createMatteBorder(0, 0, 0, 1,
            javax.swing.UIManager.getDefaults().getColor("Separator.foreground"))));
    add(toolBar, BorderLayout.WEST);
    JComponent buttonsPane = toolBar;
    viewModelListener = new ViewModelListener (
        name,
        contentComponent,
        buttonsPane,
        propertiesHelpID,
        ImageUtilities.loadImage(icon)
    );
}
 
Example 2
Source File: InfoPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private JToolBar createFilterToolBar() {
    final FiltersDescriptor filtersDesc = FiltersDescriptor.getInstance();
    // configure toolbar
    final JToolBar toolbar = new NoBorderToolBar();
    toolbar.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
    toolbar.setFloatable(false);
    //toolbar.setRollover(true);
    toolbar.setBorderPainted(false);
    toolbar.setOpaque(false);
    if( "Aqua".equals(UIManager.getLookAndFeel().getID()) ) { //NOI18N
        toolbar.setBackground(UIManager.getColor("NbExplorerView.background")); //NOI18N
    }
    createFilterToolBarUI(toolbar, filtersDesc);
    filtersDesc.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    createFilterToolBarUI(toolbar, filtersDesc);
                }
            });
        }
    });
    return toolbar;
}
 
Example 3
Source File: BsafTest.java    From libreveris with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Builds and answers the tool bar.
 */
private Component buildToolBar ()
{
    JToolBar toolBar = new SeparableToolBar();
    toolBar.setBackground(Color.PINK);
    ///toolBar.putClientProperty(Options.HEADER_STYLE_KEY, Boolean.TRUE);

    toolBar.add(createCenteredLabel("Tool Bar"));

    JButton button1 = new JButton("Bouton #1");
    toolBar.add(button1);

    toolBar.addSeparator();

    JButton button2 = new JButton("Bouton #2");
    toolBar.add(button2);

    return toolBar;
}
 
Example 4
Source File: MaterialToolBarUI.java    From material-ui-swing with MIT License 5 votes vote down vote up
@Override
public void installUI (JComponent c) {
	super.installUI (c);
	JToolBar toolBar = (JToolBar) c;

	toolBar.setFont (UIManager.getFont ("ToolBar.font"));
	toolBar.setBackground (UIManager.getColor ("ToolBar.background"));
	toolBar.setForeground (UIManager.getColor ("ToolBar.foreground"));
	toolBar.setBorder (UIManager.getBorder ("ToolBar.border"));

	this.dockingBorderColor = null;
	this.floatingBorderColor = null;
	this.dockingColor = UIManager.getColor ("ToolBar.dockingBackground");
	this.floatingColor = UIManager.getColor ("ToolBar.floatingBackground");
}
 
Example 5
Source File: PerspectivesPanelBar.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
private PerspectivesPanelBar(Perspectives perspectives) {
	setLayout(new GridBagLayout());
	setOpaque(false);

	GridBagConstraints gbc = new GridBagConstraints();
	gbc.insets = new Insets(1, 10, 2, 0);

	JToolBar workspaceToolBar = perspectives.getWorkspaceToolBar();
	workspaceToolBar.setBackground(getBackgroundColor());
	add(workspaceToolBar, gbc);
}
 
Example 6
Source File: UI.java    From arcgis-runtime-demo-java with Apache License 2.0 5 votes vote down vote up
public static JToolBar createToolbar() {
  JToolBar toolbar = new JToolBar();
  toolbar.setBorder(new LineBorder(Color.BLACK, 2));
  toolbar.setFloatable(false);
  toolbar.setOrientation(SwingConstants.VERTICAL);
  toolbar.setBackground(UI.BACKGROUND);
  return toolbar;
}
 
Example 7
Source File: UI.java    From arcgis-runtime-demo-java with Apache License 2.0 5 votes vote down vote up
public static JToolBar createToolbar() {
  JToolBar toolbar = new JToolBar();
  toolbar.setBorder(new LineBorder(Color.BLACK, 2));
  toolbar.setFloatable(false);
  toolbar.setOrientation(SwingConstants.VERTICAL);
  toolbar.setBackground(UI.BACKGROUND);
  return toolbar;
}