Search in sources :

Example 56 with JToggleButton

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

the class VFrap_OverlayEditorPanelJAI method getFillButton.

public JToggleButton getFillButton() {
    if (fillButton == null) {
        fillButton = new JToggleButton(new ImageIcon(getClass().getResource("/images/fill.gif")));
        fillButton.setPreferredSize(new Dimension(32, 32));
        fillButton.setMargin(new Insets(2, 2, 2, 2));
        fillButton.setToolTipText("Fill");
    }
    return fillButton;
}
Also used : ImageIcon(javax.swing.ImageIcon) Insets(java.awt.Insets) JToggleButton(javax.swing.JToggleButton) Dimension(java.awt.Dimension)

Example 57 with JToggleButton

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

the class VFrap_OverlayEditorPanelJAI method getRightPanel.

private JPanel getRightPanel() {
    if (rightPanel == null) {
        // this is added to the right side of the editor panel with all the buttons in two columns.
        rightPanel = new JPanel();
        final GridBagLayout gridBagLayout = new GridBagLayout();
        gridBagLayout.rowHeights = new int[] { 0, 0, 7, 7, 7, 0, 7 };
        rightPanel.setLayout(gridBagLayout);
        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
        gridBagConstraints1.gridx = 0;
        gridBagConstraints1.gridy = 0;
        rightPanel.add(getZoomInButton(), gridBagConstraints1);
        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
        if (// buttons in one column
        !isEditable) {
            gridBagConstraints2.gridx = 0;
            gridBagConstraints2.gridy = 1;
        } else // display in two columns
        {
            gridBagConstraints2.gridx = 1;
            gridBagConstraints2.gridy = 0;
        }
        rightPanel.add(getZoomOutButton(), gridBagConstraints2);
        final GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
        if (// buttons in one column
        !isEditable) {
            gridBagConstraints3.gridy = 2;
            gridBagConstraints3.gridx = 0;
        } else // display in two columns
        {
            gridBagConstraints3.gridy = 1;
            gridBagConstraints3.gridx = 0;
        }
        rightPanel.add(getContrastButtonPlus(), gridBagConstraints3);
        final GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
        if (// buttons in one column
        !isEditable) {
            gridBagConstraints4.gridy = 3;
            gridBagConstraints4.gridx = 0;
        } else // display in two columns
        {
            gridBagConstraints4.gridy = 1;
            gridBagConstraints4.gridx = 1;
        }
        rightPanel.add(getContrastButtonMinus(), gridBagConstraints4);
        /*
			 *NOTE: display type will not be applied to other buttons so far.
			 *The reason is only 4 buttons are visible in the image panel in main frame.
			 *We want one column display for the four buttons in main frame.
			 *If anyone wants one column display for all the buttons, please change following buttons accordingly.
			 */
        final GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
        gridBagConstraints5.gridy = 2;
        gridBagConstraints5.gridx = 0;
        gridBagConstraints5.insets = new Insets(12, 0, 12, 0);
        rightPanel.add(getCropButton(), gridBagConstraints5);
        final GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
        gridBagConstraints6.gridy = 2;
        gridBagConstraints6.gridx = 1;
        gridBagConstraints6.insets = new Insets(12, 0, 12, 0);
        rightPanel.add(getAutoCropButton(), gridBagConstraints6);
        final GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
        gridBagConstraints7.gridy = 3;
        gridBagConstraints7.gridx = 0;
        rightPanel.add(getPaintButton(), gridBagConstraints7);
        final GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
        gridBagConstraints8.gridy = 4;
        gridBagConstraints8.gridx = 0;
        rightPanel.add(getEraseButton(), gridBagConstraints8);
        brushToolHelper = new BrushToolHelper(new JToggleButton[] { paintButton, eraseButton }, 10, null);
        getImagePane().addMouseListener(new MouseAdapter() {

            @Override
            public void mouseEntered(MouseEvent e) {
                // TODO Auto-generated method stub
                super.mouseEntered(e);
                brushToolHelper.hidePopup();
            }
        });
        final GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
        gridBagConstraints9.gridy = 5;
        gridBagConstraints9.gridx = 0;
        rightPanel.add(getFillButton(), gridBagConstraints9);
        final GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
        gridBagConstraints10.gridy = 3;
        gridBagConstraints10.gridx = 1;
        rightPanel.add(getImportROIMaskButton(), gridBagConstraints10);
        final GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
        gridBagConstraints11.gridy = 4;
        gridBagConstraints11.gridx = 1;
        rightPanel.add(getClearROIbutton(), gridBagConstraints11);
        final GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
        gridBagConstraints12.gridy = 5;
        gridBagConstraints12.gridx = 1;
        rightPanel.add(getRoiTimePlotButton(), gridBagConstraints12);
    }
    return rightPanel;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) MouseEvent(java.awt.event.MouseEvent) GridBagLayout(java.awt.GridBagLayout) BrushToolHelper(cbit.vcell.geometry.gui.OverlayEditorPanelJAI.BrushToolHelper) JToggleButton(javax.swing.JToggleButton) MouseAdapter(java.awt.event.MouseAdapter)

Example 58 with JToggleButton

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

the class VFrap_OverlayEditorPanelJAI method getCropButton.

public JToggleButton getCropButton() {
    if (cropButton == null) {
        cropButton = new JToggleButton(new ImageIcon(getClass().getResource("/images/crop.gif")));
        cropButton.setPreferredSize(new Dimension(32, 32));
        cropButton.setMargin(new Insets(2, 2, 2, 2));
        cropButton.setToolTipText("Crop");
    }
    return cropButton;
}
Also used : ImageIcon(javax.swing.ImageIcon) Insets(java.awt.Insets) JToggleButton(javax.swing.JToggleButton) Dimension(java.awt.Dimension)

Example 59 with JToggleButton

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

the class OverlayEditorPanelJAI method getToolButtonPanel.

private JPanel getToolButtonPanel() {
    if (toolButtonPanel == null) {
        GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
        gridBagConstraints3.insets = new Insets(0, 0, 5, 0);
        gridBagConstraints3.gridy = 1;
        gridBagConstraints3.ipady = 0;
        gridBagConstraints3.ipadx = 0;
        gridBagConstraints3.gridx = 1;
        GridBagConstraints gridBagConstraints = new GridBagConstraints();
        gridBagConstraints.insets = new Insets(0, 0, 5, 5);
        gridBagConstraints.gridx = 0;
        gridBagConstraints.ipady = 0;
        gridBagConstraints.gridy = 1;
        GridBagConstraints gridBagConstraintsUndo = new GridBagConstraints();
        gridBagConstraintsUndo.insets = new Insets(0, 0, 5, 5);
        gridBagConstraintsUndo.gridy = 0;
        gridBagConstraintsUndo.ipady = 0;
        gridBagConstraintsUndo.ipadx = 0;
        gridBagConstraintsUndo.gridx = 0;
        toolButtonPanel = new JPanel();
        final GridBagLayout gbl_toolButtonPanel = new GridBagLayout();
        gbl_toolButtonPanel.rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0 };
        toolButtonPanel.setLayout(gbl_toolButtonPanel);
        toolButtonPanel.add(getUndoButton(), gridBagConstraintsUndo);
        borderToolButton = new JButton(new ImageIcon(getClass().getResource("/images/addBorder.gif")));
        borderToolButton.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                firePropertyChange(FRAP_DATA_PAD_PROPERTY, null, null);
            }
        });
        selectButton = new JToggleButton(new ImageIcon(getClass().getResource("/images/geSelect.gif")));
        selectButton.setToolTipText("Disitnct domain region pick tool");
        selectButton.setPreferredSize(new Dimension(32, 32));
        selectButton.setMinimumSize(new Dimension(32, 32));
        selectButton.setMaximumSize(new Dimension(32, 32));
        GridBagConstraints gbc_selectButton = new GridBagConstraints();
        gbc_selectButton.insets = new Insets(0, 0, 5, 0);
        gbc_selectButton.gridx = 1;
        gbc_selectButton.gridy = 0;
        toolButtonPanel.add(selectButton, gbc_selectButton);
        borderToolButton.setToolTipText("Add/Crop borders or Resize dataset");
        borderToolButton.setMinimumSize(new Dimension(32, 32));
        borderToolButton.setMaximumSize(new Dimension(32, 32));
        borderToolButton.setPreferredSize(new Dimension(32, 32));
        GridBagConstraints gbc_borderToolButton = new GridBagConstraints();
        gbc_borderToolButton.insets = new Insets(10, 0, 0, 5);
        gbc_borderToolButton.gridx = 0;
        gbc_borderToolButton.gridy = 6;
        toolButtonPanel.add(borderToolButton, gbc_borderToolButton);
        toolButtonPanel.add(getZoomInButton(), gridBagConstraints);
        toolButtonPanel.add(getZoomOutButton(), gridBagConstraints3);
        contrastButtonPlus = new JButton(new ImageIcon(getClass().getResource("/images/contrastUp.gif")));
        contrastButtonPlus.setName("contrastPlusBtn");
        contrastButtonPlus.addActionListener(new ActionListener() {

            public void actionPerformed(final ActionEvent e) {
                imagePane.increaseContrast();
                updateLabel(-1, -1);
            }
        });
        contrastButtonPlus.setPreferredSize(new Dimension(32, 32));
        contrastButtonPlus.setMinimumSize(new Dimension(32, 32));
        contrastButtonPlus.setMaximumSize(new Dimension(32, 32));
        contrastButtonPlus.setMargin(new Insets(2, 2, 2, 2));
        contrastButtonPlus.setToolTipText("Increase Contrast");
        final GridBagConstraints gridBagConstraints_4 = new GridBagConstraints();
        gridBagConstraints_4.insets = new Insets(0, 0, 5, 5);
        gridBagConstraints_4.gridy = 2;
        gridBagConstraints_4.gridx = 0;
        toolButtonPanel.add(contrastButtonPlus, gridBagConstraints_4);
        contrastButtonMinus = new JButton(new ImageIcon(getClass().getResource("/images/contrastDown.gif")));
        contrastButtonMinus.setName("contrastMinusBtn");
        contrastButtonMinus.addActionListener(new ActionListener() {

            public void actionPerformed(final ActionEvent e) {
                imagePane.decreaseContrast();
                updateLabel(-1, -1);
            }
        });
        contrastButtonMinus.setPreferredSize(new Dimension(32, 32));
        contrastButtonMinus.setMinimumSize(new Dimension(32, 32));
        contrastButtonMinus.setMaximumSize(new Dimension(32, 32));
        contrastButtonMinus.setMargin(new Insets(2, 2, 2, 2));
        contrastButtonMinus.setToolTipText("Decrease Contrast");
        final GridBagConstraints gridBagConstraints_6 = new GridBagConstraints();
        gridBagConstraints_6.insets = new Insets(0, 0, 5, 0);
        gridBagConstraints_6.gridy = 2;
        gridBagConstraints_6.gridx = 1;
        toolButtonPanel.add(contrastButtonMinus, gridBagConstraints_6);
        cropButton = new JToggleButton(new ImageIcon(getClass().getResource("/images/crop.gif")));
        cropButton.setName("roiCropBtn");
        cropButton.setPreferredSize(new Dimension(32, 32));
        cropButton.setMinimumSize(new Dimension(32, 32));
        cropButton.setMaximumSize(new Dimension(32, 32));
        cropButton.setMargin(new Insets(2, 2, 2, 2));
        cropButton.setToolTipText("Crop");
        final GridBagConstraints gridBagConstraints_5 = new GridBagConstraints();
        gridBagConstraints_5.insets = new Insets(10, 0, 5, 5);
        gridBagConstraints_5.gridy = 3;
        gridBagConstraints_5.gridx = 0;
        toolButtonPanel.add(cropButton, gridBagConstraints_5);
        autoCropButton.setPreferredSize(new Dimension(32, 32));
        autoCropButton.setMinimumSize(new Dimension(32, 32));
        autoCropButton.setMaximumSize(new Dimension(32, 32));
        autoCropButton.setMargin(new Insets(2, 2, 2, 2));
        autoCropButton.setToolTipText("Auto Crop");
        final GridBagConstraints gridBagConstraints_7 = new GridBagConstraints();
        gridBagConstraints_7.insets = new Insets(10, 0, 5, 0);
        gridBagConstraints_7.gridy = 3;
        gridBagConstraints_7.gridx = 1;
        toolButtonPanel.add(autoCropButton, gridBagConstraints_7);
        paintButton = new JToggleButton(new ImageIcon(getClass().getResource("/images/paint.gif")));
        paintButton.setName("roiPaintBtn");
        paintButton.setSelected(true);
        paintButton.setPreferredSize(new Dimension(32, 32));
        paintButton.setMinimumSize(new Dimension(32, 32));
        paintButton.setMaximumSize(new Dimension(32, 32));
        paintButton.setPreferredSize(new Dimension(32, 32));
        paintButton.setMinimumSize(new Dimension(32, 32));
        paintButton.setMaximumSize(new Dimension(32, 32));
        paintButton.setMargin(new Insets(2, 2, 2, 2));
        paintButton.setToolTipText("Paint, rt-clk menu");
        final GridBagConstraints gridBagConstraints_1 = new GridBagConstraints();
        gridBagConstraints_1.insets = new Insets(0, 0, 5, 5);
        gridBagConstraints_1.gridy = 4;
        gridBagConstraints_1.gridx = 0;
        toolButtonPanel.add(paintButton, gridBagConstraints_1);
        eraseButton = new JToggleButton(new ImageIcon(getClass().getResource("/images/eraser.gif")));
        eraseButton.setName("roiEraseBtn");
        eraseButton.setPreferredSize(new Dimension(32, 32));
        eraseButton.setMinimumSize(new Dimension(32, 32));
        eraseButton.setMaximumSize(new Dimension(32, 32));
        eraseButton.setPreferredSize(new Dimension(32, 32));
        eraseButton.setMinimumSize(new Dimension(32, 32));
        eraseButton.setMaximumSize(new Dimension(32, 32));
        eraseButton.setMargin(new Insets(2, 2, 2, 2));
        eraseButton.setToolTipText("Erase, rt-clk menu");
        final GridBagConstraints gridBagConstraints_2 = new GridBagConstraints();
        gridBagConstraints_2.insets = new Insets(0, 0, 5, 0);
        gridBagConstraints_2.gridy = 4;
        gridBagConstraints_2.gridx = 1;
        toolButtonPanel.add(eraseButton, gridBagConstraints_2);
        brushToolHelper = new BrushToolHelper(new JToggleButton[] { paintButton, eraseButton }, 10, new BrushToolHelper.CursorChanger() {

            @Override
            public void changeCursors() {
                OverlayEditorPanelJAI.this.changeCursor();
            }
        });
        getImagePane().addMouseListener(new MouseAdapter() {

            @Override
            public void mouseEntered(MouseEvent e) {
                // TODO Auto-generated method stub
                super.mouseEntered(e);
                brushToolHelper.hidePopup();
            }
        });
        fillButton = new JToggleButton(new ImageIcon(getClass().getResource("/images/fill.gif")));
        fillButton.setName("roiFillBtn");
        fillButton.setPreferredSize(new Dimension(32, 32));
        fillButton.setMinimumSize(new Dimension(32, 32));
        fillButton.setMaximumSize(new Dimension(32, 32));
        fillButton.setPreferredSize(new Dimension(32, 32));
        fillButton.setMinimumSize(new Dimension(32, 32));
        fillButton.setMaximumSize(new Dimension(32, 32));
        fillButton.setMargin(new Insets(2, 2, 2, 2));
        fillButton.setToolTipText("Fill");
        final GridBagConstraints gridBagConstraints_3 = new GridBagConstraints();
        gridBagConstraints_3.insets = new Insets(0, 0, 5, 5);
        gridBagConstraints_3.gridy = 5;
        gridBagConstraints_3.gridx = 0;
        toolButtonPanel.add(fillButton, gridBagConstraints_3);
        clearROIbutton.setPreferredSize(new Dimension(32, 32));
        clearROIbutton.setMinimumSize(new Dimension(32, 32));
        clearROIbutton.setMaximumSize(new Dimension(32, 32));
        clearROIbutton.setPreferredSize(new Dimension(32, 32));
        clearROIbutton.setMinimumSize(new Dimension(32, 32));
        clearROIbutton.setMaximumSize(new Dimension(32, 32));
        clearROIbutton.setMargin(new Insets(2, 2, 2, 2));
        clearROIbutton.setToolTipText("Clear Domain");
        final GridBagConstraints gridBagConstraints_9 = new GridBagConstraints();
        gridBagConstraints_9.insets = new Insets(0, 0, 5, 0);
        gridBagConstraints_9.gridy = 5;
        gridBagConstraints_9.gridx = 1;
        toolButtonPanel.add(clearROIbutton, gridBagConstraints_9);
        extrudeToolButton = new JButton(new ImageIcon(getClass().getResource("/images/extrude.gif")));
        extrudeToolButton.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                firePropertyChange(FRAP_DATA_DUPLICATE_PROPERTY, null, null);
            }
        });
        extrudeToolButton.setToolTipText("Extrude 2D to 3D");
        extrudeToolButton.setPreferredSize(new Dimension(32, 32));
        extrudeToolButton.setMinimumSize(new Dimension(32, 32));
        extrudeToolButton.setMaximumSize(new Dimension(32, 32));
        GridBagConstraints gbc_extrudeToolButton = new GridBagConstraints();
        gbc_extrudeToolButton.insets = new Insets(10, 0, 0, 0);
        gbc_extrudeToolButton.gridx = 1;
        gbc_extrudeToolButton.gridy = 6;
        toolButtonPanel.add(extrudeToolButton, gbc_extrudeToolButton);
    }
    return toolButtonPanel;
}
Also used : JPanel(javax.swing.JPanel) ImageIcon(javax.swing.ImageIcon) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) MouseEvent(java.awt.event.MouseEvent) GridBagLayout(java.awt.GridBagLayout) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) MouseAdapter(java.awt.event.MouseAdapter) Dimension(java.awt.Dimension) ActionListener(java.awt.event.ActionListener) JToggleButton(javax.swing.JToggleButton)

Aggregations

JToggleButton (javax.swing.JToggleButton)59 ActionEvent (java.awt.event.ActionEvent)21 ActionListener (java.awt.event.ActionListener)21 ImageIcon (javax.swing.ImageIcon)20 JPanel (javax.swing.JPanel)19 JLabel (javax.swing.JLabel)16 Dimension (java.awt.Dimension)14 JButton (javax.swing.JButton)13 Insets (java.awt.Insets)11 JScrollPane (javax.swing.JScrollPane)8 ChangeEvent (javax.swing.event.ChangeEvent)8 ChangeListener (javax.swing.event.ChangeListener)8 GridBagLayout (java.awt.GridBagLayout)7 BoxLayout (javax.swing.BoxLayout)7 GridBagConstraints (java.awt.GridBagConstraints)6 JCheckBox (javax.swing.JCheckBox)6 JSlider (javax.swing.JSlider)6 JTabbedPane (javax.swing.JTabbedPane)6 Component (java.awt.Component)5 GridLayout (java.awt.GridLayout)5