Java Code Examples for javax.swing.JToolBar#VERTICAL

The following examples show how to use javax.swing.JToolBar#VERTICAL . 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: SeaGlassIcon.java    From seaglass with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the icon's width. This is a cover methods for <code>
 * getIconWidth(null)</code>.
 *
 * @param  context the SynthContext describing the component/region, the
 *                 style, and the state.
 *
 * @return an int specifying the fixed width of the icon.
 */
@Override
public int getIconWidth(SynthContext context) {
    if (context == null) {
        return width;
    }

    JComponent c = context.getComponent();

    if (c instanceof JToolBar && ((JToolBar) c).getOrientation() == JToolBar.VERTICAL) {

        // we only do the -1 hack for UIResource borders, assuming
        // that the border is probably going to be our border
        if (c.getBorder() instanceof UIResource) {
            return c.getWidth() - 1;
        } else {
            return c.getWidth();
        }
    } else {
        return scale(context, width);
    }
}
 
Example 3
Source File: IntensityPlotToolBar.java    From mzmine2 with GNU General Public License v2.0 6 votes vote down vote up
IntensityPlotToolBar(IntensityPlotWindow window) {

    super(JToolBar.VERTICAL);

    setFloatable(false);
    setMargin(new Insets(5, 5, 5, 5));
    setBackground(Color.white);

    this.window = window;

    linesVisibleButton =
        GUIUtils.addButton(this, null, linesIcon, this, null, "Switch lines on/off");

    if (window.getChart().getPlot() instanceof XYPlot) {
      addSeparator();
      setupAxesButton =
          GUIUtils.addButton(this, null, axesIcon, this, "SETUP_AXES", "Setup ranges for axes");
    }

  }
 
Example 4
Source File: DisplayPanel3D.java    From orson-charts with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates the toolbar used to control zooming etc.
 * 
 * @param content  the 3D content that will be updated by toolbar actions.
 * 
 * @return The toolbar. 
 */
private JToolBar createToolBar(Panel3D content) {
    JToolBar tb = new JToolBar(JToolBar.VERTICAL);
    Font font = getFontAwesomeFont(FONT_SIZE);
    JButton zoomInButton = new JButton(new ZoomInAction(this.content, 
            true));
    zoomInButton.setFont(font);
    JButton zoomOutButton = new JButton(new ZoomOutAction(this.content, 
            true));
    zoomOutButton.setFont(font);
    JButton zoomToFitButton = new JButton(new ZoomToFitAction(this.content, 
            true));
    zoomToFitButton.setFont(font);
    JButton leftButton = new JButton(new LeftAction(content));
    leftButton.setFont(font);
    JButton rightButton = new JButton(new RightAction(content));
    rightButton.setFont(font);
    JButton upButton = new JButton(new UpAction(content));
    upButton.setFont(font);
    JButton downButton = new JButton(new DownAction(content));
    downButton.setFont(font);
    JButton rotateLeftButton = new JButton(new RollLeftAction(content));
    rotateLeftButton.setFont(font);
    JButton rotateRightButton = new JButton(new RollRightAction(content));
    rotateRightButton.setFont(font);
    tb.add(zoomInButton);
    tb.add(zoomOutButton);
    tb.add(zoomToFitButton);
    tb.add(new JToolBar.Separator());
    tb.add(leftButton);
    tb.add(rightButton);
    tb.add(upButton);
    tb.add(downButton);
    tb.add(rotateLeftButton);
    tb.add(rotateRightButton);
    return tb;   
}
 
Example 5
Source File: OQLConsoleView.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
EditorView(OQLEditorComponent editor) {
            super(new BorderLayout());
            
            editor.clearScrollBorders();
            add(editor, BorderLayout.CENTER);
//            add(new ScrollableContainer(editorContainer), BorderLayout.CENTER);

            JToolBar controls = new JToolBar(JToolBar.VERTICAL);
            controls.setFloatable(false);
            controls.setBorderPainted(false);
            controls.add(runAction);
            controls.add(cancelAction);
            controls.addSeparator();
            controls.add(loadAction).putClientProperty("POPUP_LEFT", Boolean.TRUE); // NOI18N
            controls.add(saveAction).putClientProperty("POPUP_LEFT", Boolean.TRUE); // NOI18N
            controls.add(editAction).putClientProperty("POPUP_LEFT", Boolean.TRUE); // NOI18N
            
            JPanel controlsContainer = new JPanel(new BorderLayout());
            controlsContainer.setOpaque(false);
            controlsContainer.setBorder(BorderFactory.createCompoundBorder(
                    BorderFactory.createMatteBorder(0, 0, 0, 1, UIManager.getColor("Separator.foreground")), // NOI18N
                    BorderFactory.createEmptyBorder(1, 1, 1, 1)));
            controlsContainer.add(controls, BorderLayout.CENTER);
            add(controlsContainer, BorderLayout.WEST);
            
            // size to always show Run and Stop buttons
            int h = controls.getComponent(0).getPreferredSize().height;
            h += controls.getComponent(1).getPreferredSize().height + 2;
            setMinimumSize(new Dimension(0, h));
        }
 
Example 6
Source File: TransparentToolBar.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
private static JToolBar createToolBar(final boolean horizontal) {
    JToolBar tb = new JToolBar(horizontal ? JToolBar.HORIZONTAL : JToolBar.VERTICAL) {
        public void layout() {
            super.layout();
            if (horizontal) {
                if (BUTTON_HEIGHT == -1)
                    BUTTON_HEIGHT = getButtonHeight();
                Insets i = getInsets();
                int height = getHeight() - i.top - i.bottom;
                for (Component comp : getComponents()) {
                    if (comp.isVisible() && (comp instanceof JButton || comp instanceof JToggleButton)) {
                        Rectangle b = comp.getBounds();
                        b.height = BUTTON_HEIGHT;
                        b.y = i.top + (height - b.height) / 2;
                        comp.setBounds(b);
                    }
                }
            }
        }
    };
    if (UISupport.isNimbusLookAndFeel())
        tb.setLayout(new BoxLayout(tb, horizontal ? BoxLayout.X_AXIS :
                                                    BoxLayout.Y_AXIS));
    tb.setBorderPainted(false);
    tb.setFloatable(false);
    tb.setRollover(true);
    tb.setOpaque(false);
    return tb;
}
 
Example 7
Source File: RConsoleView.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
EditorView(REditorComponent editor) {
            super(new BorderLayout());
            
            editor.clearScrollBorders();
            add(editor, BorderLayout.CENTER);
//            add(new ScrollableContainer(editorContainer), BorderLayout.CENTER);

            JToolBar controls = new JToolBar(JToolBar.VERTICAL);
            controls.setFloatable(false);
            controls.setBorderPainted(false);
            controls.add(runAction);
            controls.add(cancelAction);
            controls.addSeparator();
            controls.add(loadAction).putClientProperty("POPUP_LEFT", Boolean.TRUE); // NOI18N
            controls.add(saveAction).putClientProperty("POPUP_LEFT", Boolean.TRUE); // NOI18N
            controls.add(editAction).putClientProperty("POPUP_LEFT", Boolean.TRUE); // NOI18N
            
            JPanel controlsContainer = new JPanel(new BorderLayout());
            controlsContainer.setOpaque(false);
            controlsContainer.setBorder(BorderFactory.createCompoundBorder(
                    BorderFactory.createMatteBorder(0, 0, 0, 1, UIManager.getColor("Separator.foreground")), // NOI18N
                    BorderFactory.createEmptyBorder(1, 1, 1, 1)));
            controlsContainer.add(controls, BorderLayout.CENTER);
            add(controlsContainer, BorderLayout.WEST);
            
            // size to always show Run and Stop buttons
            int h = controls.getComponent(0).getPreferredSize().height;
            h += controls.getComponent(1).getPreferredSize().height + 2;
            setMinimumSize(new Dimension(0, h));
        }
 
Example 8
Source File: ClientPluginToolbar.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Instantiates a new Client plugin toolbar.
 */
ClientPluginToolbar()
{
	super(JToolBar.VERTICAL);
	setFloatable(false);
	setSize(new Dimension(TOOLBAR_WIDTH, TOOLBAR_HEIGHT));
	setMinimumSize(new Dimension(TOOLBAR_WIDTH, TOOLBAR_HEIGHT));
	setPreferredSize(new Dimension(TOOLBAR_WIDTH, TOOLBAR_HEIGHT));
	setMaximumSize(new Dimension(TOOLBAR_WIDTH, Integer.MAX_VALUE));
}
 
Example 9
Source File: PeakListTableToolBar.java    From mzmine2 with GNU General Public License v2.0 5 votes vote down vote up
PeakListTableToolBar(PeakListTableWindow masterFrame) {

    super(JToolBar.VERTICAL);

    setFloatable(false);
    setMargin(new Insets(5, 5, 5, 5));

    GUIUtils.addButton(this, null, propertiesIcon, masterFrame, "PROPERTIES",
        "Set table properties");
    GUIUtils.addButton(this, null, widthIcon, masterFrame, "AUTOCOLUMNWIDTH",
        "Set auto column width");
    addSeparator();
    GUIUtils.addButton(this, null, printIcon, masterFrame, "PRINT", "Print");

  }
 
Example 10
Source File: FiltersManagerImpl.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/**
         * Called only from AWT
         */
        private void initPanel() {
            // configure toolbar
            toolbar = new ToolbarWithOverflow(JToolBar.VERTICAL);
            toolbar.setFloatable(false);
            toolbar.setRollover(true);
            toolbar.setBorderPainted(true);
            toolbar.setBorder(
                    javax.swing.BorderFactory.createCompoundBorder(
                    javax.swing.BorderFactory.createMatteBorder(0, 1, 0, 0,
                    javax.swing.UIManager.getDefaults().getColor("Separator.foreground")), //NOI18N
                    javax.swing.BorderFactory.createEmptyBorder(0, 1, 0, 0)));
            if ("Aqua".equals(UIManager.getLookAndFeel().getID())) { //NOI18N
                toolbar.setBackground(UIManager.getColor("NbExplorerView.background"));
            }
//            toolbar.setFocusable(false);
            // create toggle buttons
            int filterCount = filtersDesc.getFilterCount();
            toggles = new ArrayList<JToggleButton>(filterCount);
            JToggleButton toggleButton;

            Map<String, Boolean> fStates = new HashMap<String, Boolean>(filterCount * 2);

            for (int i = 0; i < filterCount; i++) {
                toggleButton = createToggle(fStates, i);
                toggles.add(toggleButton);
            }

            // add toggle buttons
            JToggleButton curToggle;
            for (int i = 0; i < toggles.size(); i++) {
                curToggle = toggles.get(i);
                curToggle.addActionListener(this);
                toolbar.add(curToggle);
            }

            // initialize member states map
            synchronized (STATES_LOCK) {
                filterStates = fStates;
            }
        }
 
Example 11
Source File: HubFrame.java    From HubPlayer with GNU General Public License v3.0 4 votes vote down vote up
private void buildPanel() {
	playPanel = new PlayPanel();

	// ToolBar:the left of the Frame
	toolBar = new ButtonToolBar(JToolBar.VERTICAL, 4);

	JButton[] toolBarButtons = new JButton[] {
			new IconButton("本地列表", "icon/note.png"),
			new IconButton("网络收藏", "icon/clouds.png"),
			new IconButton("我的下载", "icon/download.png"),
			new IconButton("更多", "icon/app.png") };

	toolBar.addButtons(toolBarButtons);

	playListPanel = new PlayListPanel(toolBar.getButtons(), this);

	searchPanel = new SearchPanel();

	showPanel = new ShowPanel();

	// 传递给各面板的属性
	JTree[] listTree = playListPanel.deliverTree();
	HigherPlayer player = playPanel.getHigherPlayer();

	// 沟通播放面板与歌曲列表面板
	playPanel.setTrees(listTree);
	player.setJTree(listTree[0]);
	playListPanel.deliverHigherPlayer(player);

	// 沟通乐库面板与歌曲列表面板
	showPanel.setListTree(listTree);

	// 沟通搜索面板与展示面板
	searchPanel.setShowPanel(showPanel);

	// 沟通搜索面板与本地
	searchPanel.setSongLibraryMap(songLibrary);

	// 沟通播放面板与歌词面板
	playPanel.setLrcPanelTextArea(showPanel.getTextArea());

	// 沟通乐库面板与播放面板
	showPanel.setPlayer(player);

	playPanel.setParentFrame(this);

	// Set the preferredSize of those panels
	playPanel.setPreferredSize(new Dimension(350, 115));
	playListPanel.setPreferredSize(new Dimension(305, 520));
	toolBar.setPreferredSize(new Dimension(47, 520));
	searchPanel.setPreferredSize(new Dimension(610, 115));
	showPanel.setPreferredSize(new Dimension(610, 520));

	buildLayout();

	setAction();
}
 
Example 12
Source File: RTMZToolbar.java    From mzmine2 with GNU General Public License v2.0 4 votes vote down vote up
public RTMZToolbar(RTMZAnalyzerWindow masterFrame) {
  super(JToolBar.VERTICAL);

  setFloatable(false);
  setFocusable(false);
  setMargin(new Insets(5, 5, 5, 5));
  setBackground(Color.white);

  GUIUtils.addButton(this, null, axesIcon, masterFrame, "SETUP_AXES", "Setup ranges for axes");

  addSeparator();

  GUIUtils.addButton(this, null, colorbarIcon, masterFrame, "SETUP_COLORS",
      "Setup color palette");

}
 
Example 13
Source File: MsMsToolBar.java    From mzmine2 with GNU General Public License v2.0 3 votes vote down vote up
MsMsToolBar(MsMsVisualizerWindow masterFrame) {

    super(JToolBar.VERTICAL);

    setFloatable(false);
    setFocusable(false);
    setMargin(new Insets(5, 5, 5, 5));
    setBackground(Color.white);

    GUIUtils.addButton(this, null, axesIcon, masterFrame, "SETUP_AXES", "Setup ranges for axes");

    addSeparator();

    toggleContinuousModeButton = GUIUtils.addButton(this, null, dataPointsIcon, masterFrame,
        "SHOW_DATA_POINTS", "Toggle displaying of data points for the peaks");

    addSeparator();

    toggleTooltipButton = GUIUtils.addButton(this, null, tooltipsIcon, masterFrame,
        "SWITCH_TOOLTIPS", "Toggle displaying of tool tips on the peaks");

    addSeparator();

    GUIUtils.addButton(this, null, findIcon, masterFrame, "FIND_SPECTRA",
        "Search for MS/MS spectra with specific ions");

  }
 
Example 14
Source File: ProductIonFilterToolBar.java    From mzmine2 with GNU General Public License v2.0 3 votes vote down vote up
ProductIonFilterToolBar(ProductIonFilterVisualizerWindow masterFrame) {

    super(JToolBar.VERTICAL);

    setFloatable(false);
    setFocusable(false);
    setMargin(new Insets(5, 5, 5, 5));
    setBackground(Color.white);

    GUIUtils.addButton(this, null, dataPointsIcon, masterFrame, "HIGHLIGHT",
        "Highlight selected precursor mass range");

  }
 
Example 15
Source File: NeutralLossToolBar.java    From mzmine2 with GNU General Public License v2.0 3 votes vote down vote up
NeutralLossToolBar(NeutralLossVisualizerWindow masterFrame) {

    super(JToolBar.VERTICAL);

    setFloatable(false);
    setFocusable(false);
    setMargin(new Insets(5, 5, 5, 5));
    setBackground(Color.white);

    GUIUtils.addButton(this, null, dataPointsIcon, masterFrame, "HIGHLIGHT",
        "Highlight selected precursor mass range");

  }
 
Example 16
Source File: ButtonToolBar.java    From HubPlayer with GNU General Public License v3.0 3 votes vote down vote up
public ButtonToolBar(int orentation, int buttonNum) {
	this();

	setOrientation(orentation);

	if (orentation == JToolBar.VERTICAL)
		setLayout(new GridLayout(buttonNum, 1));

	else
		setLayout(new GridLayout(1, buttonNum));

}
 
Example 17
Source File: VanKrevelenDiagramToolBar.java    From mzmine2 with GNU General Public License v2.0 3 votes vote down vote up
public VanKrevelenDiagramToolBar(ActionListener masterFrame) {

    super(JToolBar.VERTICAL);

    setFloatable(false);
    setFocusable(false);
    setMargin(new Insets(5, 5, 5, 5));
    setBackground(Color.white);

    GUIUtils.addButton(this, null, blockSizeIcon, masterFrame, "TOGGLE_BLOCK_SIZE",
        "Toggle block size");

    addSeparator();

    GUIUtils.addButton(this, null, backColorIcon, masterFrame, "TOGGLE_BACK_COLOR",
        "Toggle background color white/black");

    addSeparator();

    GUIUtils.addButton(this, null, gridIcon, masterFrame, "TOGGLE_GRID", "Toggle grid");

    addSeparator();

    GUIUtils.addButton(this, null, annotationsIcon, masterFrame, "TOGGLE_ANNOTATIONS",
        "Toggle annotations");

    addSeparator();

  }
 
Example 18
Source File: TwoDToolBar.java    From mzmine2 with GNU General Public License v2.0 3 votes vote down vote up
TwoDToolBar(TwoDVisualizerWindow masterFrame) {

    super(JToolBar.VERTICAL);

    setFloatable(false);
    setFocusable(false);
    setMargin(new Insets(5, 5, 5, 5));
    setBackground(Color.white);

    GUIUtils.addButton(this, null, paletteIcon, masterFrame, "SWITCH_PALETTE", "Switch palette");

    addSeparator();

    toggleContinuousModeButton = GUIUtils.addButton(this, null, dataPointsIcon, masterFrame,
        "SHOW_DATA_POINTS", "Toggle displaying of data points in continuous mode");

    addSeparator();

    GUIUtils.addButton(this, null, axesIcon, masterFrame, "SETUP_AXES", "Setup ranges for axes");

    addSeparator();

    centroidContinuousButton = GUIUtils.addButton(this, null, centroidIcon, masterFrame,
        "SWITCH_PLOTMODE", "Switch between continuous and centroided mode");

    addSeparator();

    toggleTooltipButton = GUIUtils.addButton(this, null, tooltipsIcon, masterFrame,
        "SWITCH_TOOLTIPS", "Toggle displaying of tool tips on the peaks");

    addSeparator();

    GUIUtils.addButton(this, null, logScaleIcon, masterFrame, "SWITCH_LOG_SCALE", "Set Log Scale");

  }
 
Example 19
Source File: ProjectionPlotToolbar.java    From mzmine2 with GNU General Public License v2.0 3 votes vote down vote up
public ProjectionPlotToolbar(ProjectionPlotWindow masterFrame) {
  super(JToolBar.VERTICAL);

  setFloatable(false);
  setFocusable(false);
  setMargin(new Insets(5, 5, 5, 5));
  setBackground(Color.white);

  GUIUtils.addButton(this, null, axesIcon, masterFrame, "SETUP_AXES", "Setup ranges for axes");

  addSeparator();

  GUIUtils.addButton(this, null, labelsIcon, masterFrame, "TOGGLE_LABELS", "Toggle sample names");

}
 
Example 20
Source File: SpectraToolBar.java    From mzmine2 with GNU General Public License v2.0 2 votes vote down vote up
public SpectraToolBar(ActionListener masterFrame) {

    super(JToolBar.VERTICAL);

    setFloatable(false);
    setFocusable(false);
    setMargin(new Insets(5, 5, 5, 5));
    setBackground(Color.white);

    centroidContinuousButton = GUIUtils.addButton(this, null, centroidIcon, masterFrame,
        "TOGGLE_PLOT_MODE", "Toggle centroid/continuous mode");

    addSeparator();

    dataPointsButton = GUIUtils.addButton(this, null, dataPointsIcon, masterFrame,
        "SHOW_DATA_POINTS", "Toggle displaying of data points  in continuous mode");

    addSeparator();

    GUIUtils.addButton(this, null, annotationsIcon, masterFrame, "SHOW_ANNOTATIONS",
        "Toggle displaying of peak values");

    addSeparator();

    GUIUtils.addButton(this, null, pickedPeakIcon, masterFrame, "SHOW_PICKED_PEAKS",
        "Toggle displaying of picked peaks");

    addSeparator();

    GUIUtils.addButton(this, null, isotopePeakIcon, masterFrame, "SHOW_ISOTOPE_PEAKS",
        "Toggle displaying of predicted isotope peaks");

    addSeparator();

    GUIUtils.addButton(this, null, axesIcon, masterFrame, "SETUP_AXES", "Setup ranges for axes");

    addSeparator();

    GUIUtils.addButton(this, null, exportIcon, masterFrame, "EXPORT_SPECTRA",
        "Export spectra to spectra file");

    addSeparator();

    GUIUtils.addButton(this, null, exportIcon, masterFrame, "CREATE_LIBRARY_ENTRY",
        "Create spectral library entry");

    addSeparator();

    GUIUtils.addButton(this, null, dbOnlineIcon, masterFrame, "ONLINEDATABASESEARCH",
        "Select online database for annotation");

    addSeparator();

    GUIUtils.addButton(this, null, dbCustomIcon, masterFrame, "CUSTOMDATABASESEARCH",
        "Select custom database for annotation");

    addSeparator();

    GUIUtils.addButton(this, null, dbLipidsIcon, masterFrame, "LIPIDSEARCH",
        "Select target lipid classes for annotation");

    addSeparator();

    GUIUtils.addButton(this, null, dbSpectraIcon, masterFrame, "SPECTRALDATABASESEARCH",
        "Compare spectrum with spectral database");

    addSeparator();

    GUIUtils.addButton(this, null, sumFormulaIcon, masterFrame, "SUMFORMULA",
        "Predict sum formulas for annotation");

  }