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

The following examples show how to use javax.swing.JToolBar#setBorder() . 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: SimpleInternalFrame.java    From chipster with MIT License 6 votes vote down vote up
/**
 * Sets a new tool bar in the header.
 * 
 * @param newToolBar the tool bar to be set in the header
 */
public void setToolBar(JToolBar newToolBar) {
    JToolBar oldToolBar = getToolBar();
    if (oldToolBar == newToolBar) {
        return;
    }
    if (oldToolBar != null) {
        headerPanel.remove(oldToolBar);
    }
    if (newToolBar != null) {
        newToolBar.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
        headerPanel.add(newToolBar, BorderLayout.SOUTH);
    }
    updateHeader();
    firePropertyChange("toolBar", oldToolBar, newToolBar);
}
 
Example 2
Source File: TestExecutionUI.java    From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 6 votes vote down vote up
private JToolBar createToolbar() {
    JToolBar toolBar = new JToolBar();
    toolBar.setFloatable(false);
    toolBar.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    toolBar.setLayout(new javax.swing.BoxLayout(toolBar, javax.swing.BoxLayout.X_AXIS));

    JButton pull = Utils.createButton("Pull", TestExecutionUI.this);
    pull.setToolTipText("Pull Selected TestCases to TestSet");
    pull.setIcon(Utils.getIconByResourceName("/ui/resources/testExecution/pull"));
    JButton export = Utils.createButton("Export", TestExecutionUI.this);
    export.setToolTipText("Export Selected TestCases into Manual TestCases");
    export.setIcon(Utils.getIconByResourceName("/ui/resources/testExecution/export"));
    filterButton = Utils.createButton("Filter", TestExecutionUI.this);
    filterButton.setToolTipText("Filter TestCases By Tags");
    filterButton.setIcon(Utils.getIconByResourceName("/ui/resources/toolbar/tag"));
    toolBar.add(pull);
    toolBar.add(export);
    toolBar.add(filterButton);
    return toolBar;
}
 
Example 3
Source File: ResultPanelTree.java    From netbeans with Apache License 2.0 6 votes vote down vote up
ResultPanelTree(ResultDisplayHandler displayHandler, StatisticsPanel statPanel) {
        super(new BorderLayout());
        treeView = new ResultTreeView();
        treeView.getAccessibleContext().setAccessibleName(Bundle.ACSN_TestResults());
        treeView.getAccessibleContext().setAccessibleDescription(Bundle.ACSD_TestResults());
        treeView.setBorder(BorderFactory.createEtchedBorder());
//        resultBar.setPassedPercentage(0.0f);
        JToolBar toolBar = new JToolBar();
        toolBar.setFloatable(false);
        toolBar.add(resultBar);
        toolBar.setBorder(BorderFactory.createEtchedBorder());

        add(toolBar, BorderLayout.NORTH);
        add(treeView, BorderLayout.CENTER);

        explorerManager = new ExplorerManager();
        explorerManager.setRootContext(rootNode = new RootNode(displayHandler.getSession(), filterMask));
        explorerManager.addPropertyChangeListener(this);

        initAccessibility();

        this.displayHandler = displayHandler;
        this.statPanel = statPanel;
        displayHandler.setLookup(ExplorerUtils.createLookup(explorerManager, new ActionMap()));
    }
 
Example 4
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 5
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 6
Source File: TestExecutionUI.java    From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 6 votes vote down vote up
private JPanel getCompInPanel(String labelText, JComponent comp) {
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());

    JToolBar toolBar = new JToolBar();
    toolBar.setFloatable(false);
    toolBar.setBorder(BorderFactory.createEtchedBorder());
    JLabel label = new JLabel(labelText);
    label.setFont(new Font("Default", Font.BOLD, 12));
    toolBar.add(new javax.swing.Box.Filler(new java.awt.Dimension(10, 0),
            new java.awt.Dimension(10, 0),
            new java.awt.Dimension(10, 32767)));
    toolBar.add(label);
    toolBar.setPreferredSize(new java.awt.Dimension(toolBar.getPreferredSize().width, 25));

    panel.add(toolBar, BorderLayout.NORTH);
    panel.add(comp, BorderLayout.CENTER);
    return panel;
}
 
Example 7
Source File: TreeSearch.java    From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 6 votes vote down vote up
private void createToolBar() {
    searchBar = new JToolBar();
    searchBar.setFloatable(false);
    searchBar.setLayout(new BoxLayout(searchBar, BoxLayout.X_AXIS));
    searchBar.setBorder(BorderFactory.createEtchedBorder());

    JLabel searchLabel = new JLabel(Utils.getIconByResourceName("/ui/resources/search"));

    searchField = new JTextField();
    searchField.setActionCommand("SearchField");
    searchField.addActionListener(this);

    searchBar.add(searchLabel);
    searchBar.add(new javax.swing.Box.Filler(new java.awt.Dimension(5, 0),
            new java.awt.Dimension(5, 0),
            new java.awt.Dimension(5, 32767)));
    searchBar.add(searchField);

}
 
Example 8
Source File: TestDesignUI.java    From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 6 votes vote down vote up
private JPanel getTreeInPanel(String labelText, JTree tree) {
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());

    JToolBar toolBar = new JToolBar();
    toolBar.setFloatable(false);
    toolBar.setBorder(BorderFactory.createEtchedBorder());
    JLabel label = new JLabel(labelText);
    label.setFont(new Font("Default", Font.BOLD, 12));
    toolBar.add(new javax.swing.Box.Filler(new java.awt.Dimension(10, 0),
            new java.awt.Dimension(10, 0),
            new java.awt.Dimension(10, 32767)));
    toolBar.add(label);
    toolBar.add(new javax.swing.Box.Filler(new java.awt.Dimension(0, 0),
            new java.awt.Dimension(0, 0),
            new java.awt.Dimension(32767, 32767)));
    toolBar.add(getPrevoiusTestCaseButton());

    toolBar.add(getEditTagButton());
    toolBar.setPreferredSize(new java.awt.Dimension(toolBar.getPreferredSize().width, 30));
    panel.add(toolBar, BorderLayout.NORTH);
    panel.add(TreeSearch.installFor(tree), BorderLayout.CENTER);
    return panel;
}
 
Example 9
Source File: WatchAnnotationProvider.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static JToolBar createActionsToolbar() {
    JToolBar jt = new JToolBar(JToolBar.HORIZONTAL);
    jt.setBorder(new EmptyBorder(0, 0, 0, 0));
    jt.setFloatable(false);
    jt.setRollover(false);
    return jt;
}
 
Example 10
Source File: XMLEditor.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
public XMLEditor(MainFrame mainFrame) {
	super(new BorderLayout());
	this.mainFrame = mainFrame;

	// create text area
	this.editor = new RSyntaxTextArea(new RSyntaxDocument(SyntaxConstants.SYNTAX_STYLE_XML)) {

		@Override
		public synchronized void setText(String t) {
			super.setText(t);
		}
	};
	this.editor.setAnimateBracketMatching(true);
	this.editor.setAutoIndentEnabled(true);
	this.editor.setSelectionColor(Colors.TEXT_HIGHLIGHT_BACKGROUND);
	this.editor.setBorder(null);

	JToolBar toolBar = new ExtendedJToolBar();
	toolBar.setBorder(null);
	toolBar.add(new ResourceAction(true, "xml_editor.apply_changes") {

		private static final long serialVersionUID = 1L;

		@Override
		public void loggedActionPerformed(ActionEvent e) {
			try {
				validateProcess();
			} catch (IOException | XMLException e1) {
				LogService.getRoot().log(Level.WARNING,
						"com.rapidminer.gui.processeditor.XMLEditor.failed_to_parse_process");
			}
		}
	});
	toolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Colors.TEXTFIELD_BORDER));

	add(toolBar, BorderLayout.NORTH);
	RTextScrollPane rTextScrollPane = new RTextScrollPane(editor);
	rTextScrollPane.setBorder(null);
	add(rTextScrollPane, BorderLayout.CENTER);
}
 
Example 11
Source File: IOObjectCacheViewer.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
/** Initializes the GUI components of the viewer. */
private void initView() {
	// the viewer's toolbar
	JToolBar toolBar = new ExtendedJToolBar(true);
	toolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Colors.TEXTFIELD_BORDER));

	// add actions that clears all entries
	Action clearAction = new ClearCacheAction(map);
	toolBar.add(clearAction);

	// setup the header column (reuse the layout of the entries)
	JPanel headerPanel = new JPanel(IOObjectCacheEntryPanel.ENTRY_LAYOUT);
	headerPanel.add(Box.createVerticalStrut(16), IOObjectCacheEntryPanel.ICON_CONSTRAINTS);
	JLabel typeLabel = new JLabel(I18N.getGUILabel("ioobject_viewer.type"));
	typeLabel.setFont(getFont().deriveFont(Font.ITALIC));
	headerPanel.add(typeLabel, IOObjectCacheEntryPanel.TYPE_CONSTRAINTS);
	JLabel keyLabel = new JLabel(I18N.getGUILabel("ioobject_viewer.key"));
	keyLabel.setFont(getFont().deriveFont(Font.ITALIC));
	headerPanel.add(keyLabel, IOObjectCacheEntryPanel.KEY_CONSTRAINTS);
	headerPanel.add(Box.createVerticalStrut(24), IOObjectCacheEntryPanel.REMOVE_BUTTON_CONSTRAINTS);

	// create entries panel and embed in scroll pane
	scrollPane = new ExtendedJScrollPane(createEntriesPanel());
	scrollPane.setBorder(null);

	// panel containing the header row and the actual entries
	JPanel contentPanel = new JPanel(new BorderLayout());
	contentPanel.add(headerPanel, BorderLayout.NORTH);
	contentPanel.add(scrollPane, BorderLayout.CENTER);

	// put everything together
	add(toolBar, BorderLayout.NORTH);
	add(contentPanel, BorderLayout.CENTER);
}
 
Example 12
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 13
Source File: ProfilerToolbar.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Component add(ProfilerToolbar toolbar, int index) {
    JToolBar implToolbar = ((Impl)toolbar).toolbar;
    implToolbar.setBorder(BorderFactory.createEmptyBorder());
    implToolbar.setOpaque(false);
    implToolbar.putClientProperty("Toolbar.noGTKBorder", Boolean.TRUE); // NOI18N
    return add(implToolbar, index);
}
 
Example 14
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 15
Source File: ProfilerToolbar.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Component add(ProfilerToolbar toolbar, int index) {
    JToolBar implToolbar = ((Impl)toolbar).toolbar;
    implToolbar.setBorder(BorderFactory.createEmptyBorder());
    implToolbar.setOpaque(false);
    implToolbar.putClientProperty("Toolbar.noGTKBorder", Boolean.TRUE); // NOI18N
    return add(implToolbar, index);
}
 
Example 16
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 17
Source File: ConvergencePlotWidget.java    From opt4j with MIT License 5 votes vote down vote up
/**
 * Constructs a {@link ConvergencePlotWidget}.
 * 
 * @param optimizer
 *            the optimizer
 * @param data
 *            the data
 * @param objectivesMonitor
 *            the objective monitor that determine the objective of the
 *            optimization problem
 */
@Inject
public ConvergencePlotWidget(Optimizer optimizer, ConvergencePlotData data, ObjectivesMonitor objectivesMonitor,
		AutoZoomButton autoZoom) {
	super();
	this.data = data;
	selection = new Selection();

	panel = new JPanel();
	panel.setLayout(new BorderLayout());

	plot = new Plot();
	plot.addLegend(0, "Max");
	plot.addLegend(1, "Mean");
	plot.addLegend(2, "Min");
	Color[] colors = new Color[3];
	colors[0] = Color.RED;
	colors[1] = Color.LIGHT_GRAY;
	colors[2] = Color.BLUE;
	plot.setColors(colors);

	panel.add(plot);

	JToolBar menu = new JToolBar();
	menu.setFloatable(false);
	menu.add(selection);
	menu.addSeparator();
	autoZoom.setPlotBox(plot);
	menu.add(autoZoom);

	Border border = BorderFactory.createMatteBorder(0, 0, 1, 0, menu.getBackground().darker());
	menu.setBorder(border);

	panel.add(menu, BorderLayout.NORTH);

	optimizer.addOptimizerIterationListener(this);

	objectivesMonitor.addListener(this);
	doPaint();
}
 
Example 18
Source File: BatchModule.java    From DeconvolutionLab2 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public JPanel buildExpandedPanel() {

	bnRun = new JButton("Run Jobs");
	bnLaunch = new JButton("Launch Jobs");

	ArrayList<CustomizedColumn> columns = new ArrayList<CustomizedColumn>();
	columns.add(new CustomizedColumn("Job", String.class, 120, false));
	columns.add(new CustomizedColumn("Command", String.class, Constants.widthGUI, false));
	columns.add(new CustomizedColumn("", String.class, 30, "\u232B", "Delete this job"));

	table = new CustomizedTable(columns, true);
	table.getColumnModel().getColumn(2).setMaxWidth(30);
	table.getColumnModel().getColumn(2).setMinWidth(30);
	table.addMouseListener(this);
	table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

	JToolBar pn = new JToolBar("Controls Batch");
	pn.setBorder(BorderFactory.createEmptyBorder());
	pn.setLayout(new GridLayout(1, 2));
	pn.setFloatable(false);
	pn.add(bnRun);
	pn.add(bnLaunch);

	JPanel panel = new JPanel(new BorderLayout());
	panel.add(table.getPane(100, 100), BorderLayout.CENTER);
	panel.add(pn, BorderLayout.SOUTH);
	getActionButton().addActionListener(this);

	bnRun.addActionListener(this);
	bnLaunch.addActionListener(this);
	return panel;
}
 
Example 19
Source File: OpenTCSView.java    From openAGV with Apache License 2.0 4 votes vote down vote up
/**
 * Combines the OpenTCSView panel and the panel for the tool bars to a new
 * panel.
 *
 * @return The resulting panel.
 */
private JPanel wrapViewComponent() {
  // Add a dummy toolbar for dragging.
  // (Preview to see how the tool bar would look like after dragging?)
  final JToolBar toolBar = new JToolBar();
  // A wholeComponentPanel for toolbars above the OpenTCSView wholeComponentPanel.
  final JPanel toolBarPanel = new JPanel();
  toolBarPanel.setLayout(new BoxLayout(toolBarPanel, BoxLayout.LINE_AXIS));
  toolBar.setBorder(new PaletteToolBarBorder());

  final List<JToolBar> lToolBars = new LinkedList<>();

  // The new wholeComponentPanel for the whole component.
  JPanel wholeComponentPanel = new JPanel(new BorderLayout());
  wholeComponentPanel.add(toolBarPanel, BorderLayout.NORTH);
  wholeComponentPanel.add(getComponent());
  lToolBars.add(toolBar);

  JPanel viewComponent = wholeComponentPanel;

  LinkedList<Action> toolBarActions = new LinkedList<>();

  // XXX Why is this list iterated in *reverse* order?
  for (JToolBar curToolBar : new ReversedList<>(toolBarManager.getToolBars())) {
    // A panel that wraps the toolbar.
    final JPanel curToolBarPanel = new JPanel();
    curToolBarPanel.setLayout(new BoxLayout(curToolBarPanel, BoxLayout.LINE_AXIS));
    // A panel that wraps the (wrapped) toolbar and the previous component
    // (the whole view and the nested/wrapped toolbars).
    JPanel wrappingPanel = new JPanel(new BorderLayout());
    curToolBar.setBorder(new PaletteToolBarBorder());

    curToolBarPanel.add(curToolBar);
    wrappingPanel.add(curToolBarPanel, BorderLayout.NORTH);
    wrappingPanel.add(viewComponent);

    lToolBars.add(curToolBar);
    viewComponent = wrappingPanel;
    toolBarActions.addFirst(new ToggleVisibleAction(curToolBar, curToolBar.getName()));
  }

  for (JToolBar bar : lToolBars) {
    configureToolBarButtons(bar);
  }

  getComponent().putClientProperty(TOOLBAR_ACTIONS_PROPERTY, toolBarActions);

  return viewComponent;
}
 
Example 20
Source File: OutputModule.java    From DeconvolutionLab2 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public JPanel buildExpandedPanel() {
	
	String[] dynamics = { 
			"intact (no change) [default]", 
			"rescaled  (linear scaling from min to max)", 
			"normalized (mean=0, stdev=1)", 
			"clipped  (clip to min, saturate to max)"
			};
	String[] types = { 
			"float (32-bits) [default]", 
			"short (16-bits)", 
			"byte (8-bits)" };

	ArrayList<CustomizedColumn> columns = new ArrayList<CustomizedColumn>();
	columns.add(new CustomizedColumn("Mode", String.class, 80, false));
	columns.add(new CustomizedColumn("Snapshot", String.class, 50, false));
	columns.add(new CustomizedColumn("Name", String.class, Constants.widthGUI, true));
	columns.add(new CustomizedColumn("Dynamic", String.class, 100, dynamics, "Select the dynamic range"));
	columns.add(new CustomizedColumn("Type", String.class, 100, types, "Select the type"));
	columns.add(new CustomizedColumn("Origin", String.class, 120, false));
	columns.add(new CustomizedColumn("Show", String.class, 50, false));
	columns.add(new CustomizedColumn("Save", String.class, 50, false));
	columns.add(new CustomizedColumn("Del", String.class, 30, "\u232B", "Delete this image source"));
	table = new CustomizedTable(columns, true);
	table.getColumnModel().getColumn(6).setMaxWidth(50);
	table.getColumnModel().getColumn(7).setMaxWidth(50);
	table.getColumnModel().getColumn(8).setMaxWidth(30);
	table.getColumnModel().getColumn(0).setMaxWidth(100);
	table.getColumnModel().getColumn(3).setMaxWidth(100);
	table.getColumnModel().getColumn(4).setMaxWidth(100);
	
	table.addMouseListener(this);
	
	JToolBar pn = new JToolBar("Controls Image");
	pn.setBorder(BorderFactory.createEmptyBorder());
	pn.setLayout(new GridLayout(1, 6));
	pn.setFloatable(false);

	JPanel panel = new JPanel();
	panel.setBorder(BorderFactory.createEtchedBorder());
	panel.setLayout(new BorderLayout());
	panel.add(pn, BorderLayout.SOUTH);
	panel.add(table.getMinimumPane(100, 100), BorderLayout.CENTER);

	getActionButton().addActionListener(this);
	
	table.getComboBox(3).addActionListener(this);
	table.getComboBox(4).addActionListener(this);

	Config.registerTable(getName(), "output", table);
	return panel;
}