javax.swing.JToolBar#setBorder ( )源码实例Demo

下面列出了javax.swing.JToolBar#setBorder ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: chipster   文件: SimpleInternalFrame.java
/**
 * 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);
}
 
源代码2 项目: netbeans   文件: ResultPanelTree.java
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()));
    }
 
源代码3 项目: netbeans   文件: ViewComponent.java
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)
    );
}
 
源代码4 项目: netbeans   文件: InfoPanel.java
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;
}
 
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);

}
 
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;
}
 
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;
}
 
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;
}
 
源代码9 项目: DeconvolutionLab2   文件: BatchModule.java
@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;
}
 
源代码10 项目: opt4j   文件: ConvergencePlotWidget.java
/**
 * 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();
}
 
源代码11 项目: arcgis-runtime-demo-java   文件: UI.java
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;
}
 
源代码12 项目: netbeans   文件: ProfilerToolbar.java
@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);
}
 
源代码13 项目: netbeans   文件: WatchAnnotationProvider.java
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;
}
 
源代码14 项目: arcgis-runtime-demo-java   文件: UI.java
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;
}
 
源代码15 项目: visualvm   文件: ProfilerToolbar.java
@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);
}
 
源代码16 项目: material-ui-swing   文件: MaterialToolBarUI.java
@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");
}
 
源代码17 项目: rapidminer-studio   文件: IOObjectCacheViewer.java
/** 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);
}
 
源代码18 项目: rapidminer-studio   文件: XMLEditor.java
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);
}
 
源代码19 项目: openAGV   文件: OpenTCSView.java
/**
 * 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;
}
 
源代码20 项目: DeconvolutionLab2   文件: OutputModule.java
@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;
}