Search in sources :

Example 1 with JToolBarToggleButton

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

the class StructureMappingCartoonPanel method getSelectButton.

/**
 * Return the SelectButton property value.
 * @return cbit.gui.JToolBarToggleButton
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private JToolBarToggleButton getSelectButton() {
    if (ivjSelectButton == null) {
        try {
            ivjSelectButton = new JToolBarToggleButton();
            ivjSelectButton.setName("SelectButton");
            ivjSelectButton.setText("");
            ivjSelectButton.setMaximumSize(new java.awt.Dimension(28, 28));
            ivjSelectButton.setActionCommand(Mode.SELECT.getActionCommand());
            ivjSelectButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/select.gif")));
            ivjSelectButton.setSelected(true);
            ivjSelectButton.setPreferredSize(new java.awt.Dimension(28, 28));
            ivjSelectButton.setMinimumSize(new java.awt.Dimension(28, 28));
        // user code begin {1}
        // user code end
        } catch (java.lang.Throwable ivjExc) {
            // user code begin {2}
            // user code end
            handleException(ivjExc);
        }
    }
    return ivjSelectButton;
}
Also used : JToolBarToggleButton(org.vcell.util.gui.JToolBarToggleButton)

Example 2 with JToolBarToggleButton

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

the class GroupRuleToolShape 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);
    Color c1;
    Color c2;
    Color c3;
    Color c4;
    // offset from upper left corner
    int init;
    switch(state) {
        case normal:
            init = 0;
            c1 = Color.red.darker();
            c2 = Color.darkGray;
            c3 = Color.gray;
            c4 = Color.yellow;
            break;
        case selected:
            init = 1;
            c1 = Color.red.darker().darker();
            c2 = Color.darkGray;
            c3 = Color.gray;
            c4 = Color.yellow;
            break;
        case disabled:
        default:
            init = 0;
            c1 = Color.lightGray;
            c2 = Color.lightGray;
            c3 = Color.lightGray;
            c4 = AbstractComponentShape.componentPaleYellow;
            break;
    }
    g2.setStroke(new BasicStroke(1.2f));
    g2.setPaint(c2);
    // the large square
    final int delta = 15;
    int xx = x + init + 1;
    int yy = y + init + 1;
    Rectangle2D rect = new Rectangle2D.Double(xx, yy, delta + 1, delta);
    g2.draw(rect);
    g2.setStroke(new BasicStroke(0.8f));
    final int delta2 = 5;
    // the lower small rectangle
    xx += 7;
    yy += 3;
    rect = new Rectangle2D.Double(xx, yy, delta2 + 1, delta2);
    g2.setPaint(c4);
    // overwrite some of the smaller rectangle
    g2.fill(rect);
    g2.setPaint(c3);
    g2.draw(rect);
    // the middle small rectangle
    xx -= 2;
    yy += 2;
    rect = new Rectangle2D.Double(xx, yy, delta2 + 1, delta2);
    g2.setPaint(c4);
    // overwrite some of the smaller rectangle
    g2.fill(rect);
    g2.setPaint(c3);
    g2.draw(rect);
    // the upper small rectangle
    xx -= 2;
    yy += 2;
    rect = new Rectangle2D.Double(xx, yy, delta2 + 1, delta2);
    g2.setPaint(c4);
    // overwrite some of the smaller rectangle
    g2.fill(rect);
    g2.setPaint(c3);
    g2.draw(rect);
    // ---------------------------------------------------------------------
    int m = 3;
    // upper left corner small red square
    g2.setStroke(new BasicStroke(1.0f));
    g2.setPaint(c1);
    xx = x + init;
    yy = y + init;
    rect = new Rectangle2D.Double(xx, yy, m, m);
    // g2.draw(rect);
    g2.fill(rect);
    xx = x + init + delta + 1;
    yy = y + init;
    rect = new Rectangle2D.Double(xx, yy, m, m);
    g2.fill(rect);
    xx = x + init;
    yy = y + init + delta;
    rect = new Rectangle2D.Double(xx, yy, m, m);
    g2.fill(rect);
    xx = x + init + delta + 1;
    yy = y + init + delta;
    rect = new Rectangle2D.Double(xx, yy, m, m);
    g2.fill(rect);
    g2.setStroke(strokeOld);
    g2.setColor(colorOld);
    g2.setPaint(paintOld);
}
Also used : BasicStroke(java.awt.BasicStroke) Stroke(java.awt.Stroke) BasicStroke(java.awt.BasicStroke) Color(java.awt.Color) Rectangle2D(java.awt.geom.Rectangle2D) Paint(java.awt.Paint) JToolBarToggleButton(org.vcell.util.gui.JToolBarToggleButton) Paint(java.awt.Paint) Graphics2D(java.awt.Graphics2D)

Example 3 with JToolBarToggleButton

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

the class ReactionCartoonEditorPanel method createModeButton.

private JToolBarToggleButton createModeButton(String name, String toolTip, Mode mode, Icon icon) {
    JToolBarToggleButton button = new JToolBarToggleButton();
    button.setName(name);
    button.setToolTipText(toolTip);
    button.setActionCommand(mode.getActionCommand());
    button.setIcon(icon);
    setToolBarButtonSizes(button);
    return button;
}
Also used : JToolBarToggleButton(org.vcell.util.gui.JToolBarToggleButton)

Example 4 with JToolBarToggleButton

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

the class ReactionCartoonEditorPanel method getSpeciesButton.

private JToolBarToggleButton getSpeciesButton() {
    if (speciesButton == null) {
        try {
            JToolBarToggleButton button = new JToolBarToggleButton();
            SpeciesToolShapeIcon.setSpeciesToolMod(button);
            button.setActionCommand(Mode.SPECIES.getActionCommand());
            speciesButton = button;
        // speciesButton = createModeButton("SpeciesButton", "Species Tool", Mode.SPECIES, loadIcon("/images/species.gif"));
        } catch (Throwable throwable) {
            handleException(throwable);
        }
    }
    return speciesButton;
}
Also used : JToolBarToggleButton(org.vcell.util.gui.JToolBarToggleButton)

Example 5 with JToolBarToggleButton

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

the class ReactionCartoonEditorPanel method getSizeByLengthButton.

private JToolBarToggleButton getSizeByLengthButton() {
    if (sizeByLengthButton == null) {
        try {
            JToolBarToggleButton button = new JToolBarToggleButton();
            SpeciesSizeShapeIcon.setSpeciesSizeShapeMod(button, SpeciesSizeShapeIcon.Kind.length);
            button.setActionCommand(Mode.SIZEBYLENGTH.getActionCommand());
            sizeByLengthButton = button;
        } catch (Throwable throwable) {
            handleException(throwable);
        }
    }
    return sizeByLengthButton;
}
Also used : JToolBarToggleButton(org.vcell.util.gui.JToolBarToggleButton)

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