Search in sources :

Example 66 with JToolBar

use of javax.swing.JToolBar in project vcell by virtualcell.

the class ParameterMappingPanel method initialize.

/**
 * Initialize the class.
 */
private void initialize() {
    try {
        setName("ModelParameterPanel");
        setLayout(new java.awt.BorderLayout());
        setSize(655, 226);
        addButton = new JButton(VCellIcons.addIcon);
        deleteButton = new JButton(VCellIcons.deleteIcon);
        deleteButton.setEnabled(false);
        JToolBar toolBar = new JToolBar();
        toolBar.setFloatable(false);
        toolBar.add(addButton);
        toolBar.add(deleteButton);
        add(getScrollPaneTable().getEnclosingScrollPane(), BorderLayout.CENTER);
        add(toolBar, BorderLayout.NORTH);
        addButton.addActionListener(ivjEventHandler);
        deleteButton.addActionListener(ivjEventHandler);
        getScrollPaneTable().getSelectionModel().addListSelectionListener(ivjEventHandler);
        initConnections();
        getScrollPaneTable().setDefaultRenderer(Double.class, new DefaultScrollTableCellRenderer() {

            @Override
            public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
                super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
                setHorizontalAlignment(RIGHT);
                return this;
            }
        });
    } catch (java.lang.Throwable ivjExc) {
        handleException(ivjExc);
    }
}
Also used : JButton(javax.swing.JButton) JToolBar(javax.swing.JToolBar) JTable(javax.swing.JTable) DefaultScrollTableCellRenderer(org.vcell.util.gui.DefaultScrollTableCellRenderer) BorderLayout(java.awt.BorderLayout) Component(java.awt.Component)

Example 67 with JToolBar

use of javax.swing.JToolBar in project vcell by virtualcell.

the class ScrollTable method getPageToolBar.

private JToolBar getPageToolBar() {
    if (pageToolBar == null) {
        pageLabel = new JLabel();
        pageLabel.setBorder(new EmptyBorder(2, 5, 2, 2));
        firstPageButton = createToolBarButton(VCellIcons.firstPageIcon);
        previousPageButton = createToolBarButton(VCellIcons.previousPageIcon);
        nextPageButton = createToolBarButton(VCellIcons.nextPageIcon);
        lastPageButton = createToolBarButton(VCellIcons.lastPageIcon);
        pageToolBar = new JToolBar();
        pageToolBar.setFloatable(false);
        pageToolBar.add(Box.createHorizontalGlue());
        pageToolBar.add(firstPageButton);
        pageToolBar.add(previousPageButton);
        pageToolBar.add(pageLabel);
        pageToolBar.add(nextPageButton);
        pageToolBar.add(lastPageButton);
    }
    return pageToolBar;
}
Also used : JLabel(javax.swing.JLabel) JToolBar(javax.swing.JToolBar) EmptyBorder(javax.swing.border.EmptyBorder)

Example 68 with JToolBar

use of javax.swing.JToolBar in project vcell by virtualcell.

the class BioModelEditorPathwayDiagramPanel method createToolBar.

private JToolBar createToolBar(int orientation) {
    JToolBar toolBar = new JToolBar();
    toolBar.setFloatable(false);
    toolBar.setBorder(new javax.swing.border.EtchedBorder());
    toolBar.setOrientation(orientation);
    for (ActionID id : ActionID.values()) {
        ActionBuilder actionBuilder = actionBuilderMap.get(id);
        if (actionBuilder != null) {
            Action action = actionBuilder.buildAction(this);
            if (action != null) {
                toolBar.add(createToolBarButton(action));
            }
        }
    }
    return toolBar;
}
Also used : AbstractAction(javax.swing.AbstractAction) Action(javax.swing.Action) ActionBuilder(org.vcell.util.gui.ActionBuilder) JToolBar(javax.swing.JToolBar)

Example 69 with JToolBar

use of javax.swing.JToolBar in project vcell by virtualcell.

the class BatchRunDetailsPanel method getToolBar.

public JToolBar getToolBar() {
    if (toolbar == null) {
        toolbar = new JToolBar();
        for (int i = 0; i < buttonLabels.length; ++i) {
            icons[i] = new ImageIcon(iconFiles[i]);
        }
        addButton = new JButton(icons[0]);
        addButton.setMargin(new Insets(0, 0, 0, 0));
        addButton.setToolTipText(buttonLabels[0]);
        addButton.setBorderPainted(false);
        addButton.addActionListener(this);
        deleteButton = new JButton(icons[1]);
        deleteButton.setMargin(new Insets(0, 0, 0, 0));
        deleteButton.setToolTipText(buttonLabels[1]);
        deleteButton.setBorderPainted(false);
        deleteButton.addActionListener(this);
        delAllButton = new JButton(icons[2]);
        delAllButton.setMargin(new Insets(0, 0, 0, 0));
        delAllButton.setToolTipText(buttonLabels[2]);
        delAllButton.setBorderPainted(false);
        delAllButton.addActionListener(this);
        toolbar.add(addButton);
        toolbar.add(deleteButton);
        toolbar.add(delAllButton);
        toolbar.setFloatable(false);
    }
    return toolbar;
}
Also used : ImageIcon(javax.swing.ImageIcon) Insets(java.awt.Insets) JButton(javax.swing.JButton) JToolBar(javax.swing.JToolBar)

Example 70 with JToolBar

use of javax.swing.JToolBar in project smile by haifengl.

the class PlotCanvas method initContextMenauAndToolBar.

/**
     * Initialize context menu and toolbar.
     */
private void initContextMenauAndToolBar() {
    toolbar = new JToolBar();
    toolbar.add(new Button(saveAction));
    toolbar.add(new Button(printAction));
    toolbar.addSeparator();
    toolbar.add(new Button(zoomInAction));
    toolbar.add(new Button(zoomOutAction));
    toolbar.add(new Button(resetAction));
    toolbar.addSeparator();
    toolbar.add(new Button(enlargePlotAreaAction));
    toolbar.add(new Button(shrinkPlotAreaAction));
    toolbar.add(new Button(increaseHeightAction));
    toolbar.add(new Button(decreaseHeightAction));
    toolbar.add(new Button(increaseWidthAction));
    toolbar.add(new Button(decreaseWidthAction));
    toolbar.addSeparator();
    toolbar.add(new Button(propertyAction));
    decreaseHeightAction.setEnabled(false);
    decreaseWidthAction.setEnabled(false);
    //Initialize popup menu.
    popup = new JPopupMenu();
    popup.add(new JMenuItem(saveAction));
    popup.add(new JMenuItem(printAction));
    popup.addSeparator();
    popup.add(new JMenuItem(zoomInAction));
    popup.add(new JMenuItem(zoomOutAction));
    popup.add(new JMenuItem(resetAction));
    popup.addSeparator();
    popup.add(new JMenuItem(enlargePlotAreaAction));
    popup.add(new JMenuItem(shrinkPlotAreaAction));
    popup.add(new JMenuItem(increaseHeightAction));
    popup.add(new JMenuItem(decreaseHeightAction));
    popup.add(new JMenuItem(increaseWidthAction));
    popup.add(new JMenuItem(decreaseWidthAction));
    popup.addSeparator();
    popup.add(new JMenuItem(propertyAction));
    AncestorListener ancestorListener = new AncestorListener() {

        @Override
        public void ancestorAdded(AncestorEvent ae) {
            boolean inScrollPane = false;
            Container parent = getParent();
            while (parent != null) {
                if (parent instanceof JScrollPane) {
                    inScrollPane = true;
                    scrollPane = (JScrollPane) parent;
                    break;
                }
                parent = parent.getParent();
            }
            increaseHeightAction.setEnabled(inScrollPane);
            increaseWidthAction.setEnabled(inScrollPane);
        }

        @Override
        public void ancestorRemoved(AncestorEvent ae) {
        }

        @Override
        public void ancestorMoved(AncestorEvent ae) {
        }
    };
    addAncestorListener(ancestorListener);
}
Also used : JScrollPane(javax.swing.JScrollPane) Container(java.awt.Container) Button(smile.swing.Button) JButton(javax.swing.JButton) AncestorListener(javax.swing.event.AncestorListener) JToolBar(javax.swing.JToolBar) JMenuItem(javax.swing.JMenuItem) AncestorEvent(javax.swing.event.AncestorEvent) JPopupMenu(javax.swing.JPopupMenu)

Aggregations

JToolBar (javax.swing.JToolBar)124 JButton (javax.swing.JButton)51 BorderLayout (java.awt.BorderLayout)45 JPanel (javax.swing.JPanel)37 JScrollPane (javax.swing.JScrollPane)30 Dimension (java.awt.Dimension)25 Insets (java.awt.Insets)25 ActionEvent (java.awt.event.ActionEvent)24 JLabel (javax.swing.JLabel)23 ActionListener (java.awt.event.ActionListener)19 ImageIcon (javax.swing.ImageIcon)17 Component (java.awt.Component)14 JSplitPane (javax.swing.JSplitPane)14 JTable (javax.swing.JTable)14 JTextField (javax.swing.JTextField)14 JPopupMenu (javax.swing.JPopupMenu)13 JToggleButton (javax.swing.JToggleButton)12 GridBagConstraints (java.awt.GridBagConstraints)10 GridBagLayout (java.awt.GridBagLayout)10 JComponent (javax.swing.JComponent)10