Search in sources :

Example 11 with JToolBarToggleButton

use of org.vcell.util.gui.JToolBarToggleButton in project vcell by virtualcell.

the class ReactionCartoonEditorPanel method getUngroupButton.

private JToolBarToggleButton getUngroupButton() {
    if (ungroupButton == null) {
        try {
            JToolBarToggleButton button = new JToolBarToggleButton();
            UngroupToolShapeIcon.setMod(button);
            button.setActionCommand(Mode.UNGROUP.getActionCommand());
            ungroupButton = button;
        } catch (Throwable throwable) {
            handleException(throwable);
        }
    }
    return ungroupButton;
}
Also used : JToolBarToggleButton(org.vcell.util.gui.JToolBarToggleButton)

Example 12 with JToolBarToggleButton

use of org.vcell.util.gui.JToolBarToggleButton in project vcell by virtualcell.

the class ReactionCartoonEditorPanel method initConnections.

private void initConnections() throws Exception {
    for (JToolBarToggleButton modeButton : getModeButtons()) {
        modeButton.addActionListener(this);
    }
    for (JToolBarToggleButton viewButton : getViewButtons()) {
        viewButton.addActionListener(this);
    }
    ButtonModel selection = modeButtonGroup.getSelection();
    if (selection != null) {
        getReactionCartoonTool().setModeString(selection.getActionCommand());
    } else {
        getReactionCartoonTool().setMode(Mode.SELECT);
    }
    getRandomLayoutButton().addActionListener(this);
    getAnnealLayoutButton().addActionListener(this);
    getCircleLayoutButton().addActionListener(this);
    getRelaxerLayoutButton().addActionListener(this);
    getLevellerLayoutButton().addActionListener(this);
    getZoomInButton().addActionListener(this);
    getZoomOutButton().addActionListener(this);
    getGlgLayoutJButton().addActionListener(this);
    getShrinkCanvasButton().addActionListener(this);
    getExpandCanvasButton().addActionListener(this);
    getFloatRequestButton().addActionListener(this);
    getHighlightCatalystsButton().addActionListener(this);
    for (JToolBarToggleButton sizeButton : getSizeOptionsButtons()) {
        sizeButton.addActionListener(this);
    }
}
Also used : ButtonModel(javax.swing.ButtonModel) JToolBarToggleButton(org.vcell.util.gui.JToolBarToggleButton)

Example 13 with JToolBarToggleButton

use of org.vcell.util.gui.JToolBarToggleButton in project vcell by virtualcell.

the class ReactionCartoonEditorPanel method getGroupMoleculeButton.

private JToolBarToggleButton getGroupMoleculeButton() {
    if (groupMoleculeButton == null) {
        try {
            JToolBarToggleButton button = new JToolBarToggleButton();
            GroupMoleculeToolShape.setMod(button);
            button.setActionCommand(Mode.GROUPMOLECULE.getActionCommand());
            groupMoleculeButton = button;
        } catch (Throwable throwable) {
            handleException(throwable);
        }
    }
    return groupMoleculeButton;
}
Also used : JToolBarToggleButton(org.vcell.util.gui.JToolBarToggleButton)

Example 14 with JToolBarToggleButton

use of org.vcell.util.gui.JToolBarToggleButton in project vcell by virtualcell.

the class ReactionCartoonEditorPanel method getHighlightCatalystsButton.

private JToolBarToggleButton getHighlightCatalystsButton() {
    if (highlightCatalystsButton == null) {
        try {
            JToolBarToggleButton button = new JToolBarToggleButton();
            HighlightCatalystShapeIcon.setStructureToolMod(button);
            button.setActionCommand(Mode.HIGHLIGHTCATALYST.getActionCommand());
            highlightCatalystsButton = button;
        } catch (Throwable throwable) {
            handleException(throwable);
        }
    }
    return highlightCatalystsButton;
}
Also used : JToolBarToggleButton(org.vcell.util.gui.JToolBarToggleButton)

Example 15 with JToolBarToggleButton

use of org.vcell.util.gui.JToolBarToggleButton in project vcell by virtualcell.

the class SpeciesToolShapeIcon method paintIcon.

@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
    if (c == null) {
        return;
    }
    if (!(c instanceof JToolBarToggleButton)) {
        return;
    }
    JToolBarToggleButton b = (JToolBarToggleButton) c;
    Graphics2D g2 = (Graphics2D) g;
    Color colorOld = g2.getColor();
    Paint paintOld = g2.getPaint();
    Stroke strokeOld = g2.getStroke();
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    // (diameter-circleDiameter) / 2
    int xx = 2;
    int yy = 2;
    Color exterior, interior;
    if (state == State.normal) {
        exterior = Color.green.darker().darker();
        interior = Color.white;
        xx += x;
        yy += y;
    } else {
        exterior = Color.green.darker();
        interior = Color.white;
        // button moves a little bit to simulate 3D pressing of a button
        xx += x + 1;
        yy += y + 1;
    }
    Ellipse2D e = new Ellipse2D.Double(xx, yy, circleDiameter, circleDiameter);
    Point2D center = new Point2D.Float(xx + circleDiameter / 2, yy + circleDiameter / 2);
    float radius = circleDiameter * 0.5f;
    Point2D focus = new Point2D.Float(xx + circleDiameter / 2 - 2, yy + circleDiameter / 2 - 2);
    float[] dist = { 0.1f, 1.0f };
    Color[] colors = { interior, exterior };
    RadialGradientPaint p = new RadialGradientPaint(center, radius, focus, dist, colors, CycleMethod.NO_CYCLE);
    g2.setPaint(p);
    g2.fill(e);
    g.setColor(Color.black);
    g2.draw(e);
    g2.setStroke(strokeOld);
    g2.setColor(colorOld);
    g2.setPaint(paintOld);
}
Also used : Stroke(java.awt.Stroke) Color(java.awt.Color) RadialGradientPaint(java.awt.RadialGradientPaint) Paint(java.awt.Paint) RadialGradientPaint(java.awt.RadialGradientPaint) JToolBarToggleButton(org.vcell.util.gui.JToolBarToggleButton) RadialGradientPaint(java.awt.RadialGradientPaint) Paint(java.awt.Paint) Ellipse2D(java.awt.geom.Ellipse2D) Graphics2D(java.awt.Graphics2D) Point2D(java.awt.geom.Point2D)

Aggregations

JToolBarToggleButton (org.vcell.util.gui.JToolBarToggleButton)18 Color (java.awt.Color)5 Graphics2D (java.awt.Graphics2D)5 Paint (java.awt.Paint)5 Stroke (java.awt.Stroke)5 BasicStroke (java.awt.BasicStroke)4 Rectangle2D (java.awt.geom.Rectangle2D)3 GradientPaint (java.awt.GradientPaint)1 RadialGradientPaint (java.awt.RadialGradientPaint)1 Arc2D (java.awt.geom.Arc2D)1 Ellipse2D (java.awt.geom.Ellipse2D)1 Line2D (java.awt.geom.Line2D)1 Point2D (java.awt.geom.Point2D)1 ButtonModel (javax.swing.ButtonModel)1