Search in sources :

Example 1 with BrushToolHelper

use of cbit.vcell.geometry.gui.OverlayEditorPanelJAI.BrushToolHelper 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)

Aggregations

BrushToolHelper (cbit.vcell.geometry.gui.OverlayEditorPanelJAI.BrushToolHelper)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1 MouseAdapter (java.awt.event.MouseAdapter)1 MouseEvent (java.awt.event.MouseEvent)1 JPanel (javax.swing.JPanel)1 JToggleButton (javax.swing.JToggleButton)1