Search in sources :

Example 16 with JToolBarToggleButton

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

the class UngroupToolShapeIcon 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.lightGray;
            c3 = Color.gray;
            c4 = AbstractComponentShape.componentMediumPalePink;
            break;
        case selected:
            init = 1;
            c1 = Color.red.darker().darker();
            c2 = Color.darkGray;
            c3 = Color.gray;
            c4 = AbstractComponentShape.componentPalePink;
            break;
        case disabled:
        default:
            init = 0;
            c1 = Color.lightGray;
            c2 = Color.lightGray;
            c3 = Color.lightGray;
            c4 = AbstractComponentShape.componentMediumPalePink;
            break;
    }
    Rectangle2D rect;
    g2.setStroke(new BasicStroke(0.8f));
    final int delta2 = 10;
    // the lower small rectangle
    int xx1 = x + init + 5;
    int yy1 = y + init + 6;
    rect = new Rectangle2D.Double(xx1, yy1, delta2 + 1, delta2);
    g2.setPaint(c3);
    g2.draw(rect);
    int m = 3;
    // upper right corner small red square
    g2.setStroke(new BasicStroke(1.0f));
    g2.setPaint(c1);
    int xx = xx1 + delta2;
    int yy = yy1 - 1;
    rect = new Rectangle2D.Double(xx, yy, m, m);
    g2.fill(rect);
    xx = xx1 - 1;
    yy = yy1 + delta2 - 1;
    rect = new Rectangle2D.Double(xx, yy, m, m);
    g2.fill(rect);
    xx = xx1 + delta2;
    yy = yy1 + delta2 - 1;
    rect = new Rectangle2D.Double(xx, yy, m, m);
    g2.fill(rect);
    // ------------------------------------------------------------------------
    g2.setStroke(new BasicStroke(0.8f));
    // the upper small rectangle
    int xx2 = x + init + 1;
    int yy2 = y + init + 2;
    rect = new Rectangle2D.Double(xx2, yy2, delta2 + 1, delta2);
    g2.setPaint(c4);
    // overwrite some of the smaller rectangle
    g2.fill(rect);
    g2.setPaint(c3);
    g2.draw(rect);
    // upper left corner small red square
    g2.setStroke(new BasicStroke(1.0f));
    g2.setPaint(c1);
    xx = xx2 - 1;
    yy = yy2 - 1;
    rect = new Rectangle2D.Double(xx, yy, m, m);
    g2.fill(rect);
    xx = xx2 + delta2;
    yy = yy2 - 1;
    rect = new Rectangle2D.Double(xx, yy, m, m);
    g2.fill(rect);
    xx = xx2 - 1;
    yy = yy2 + delta2 - 1;
    rect = new Rectangle2D.Double(xx, yy, m, m);
    g2.fill(rect);
    xx = xx2 + delta2;
    yy = yy2 + delta2 - 1;
    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 17 with JToolBarToggleButton

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

the class PlotPane method getDataButton.

/**
 * Return the DataButton property value.
 * @return cbit.gui.JToolBarToggleButton
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private JToolBarToggleButton getDataButton() {
    if (ivjDataButton == null) {
        try {
            ivjDataButton = new JToolBarToggleButton();
            ivjDataButton.setName("DataButton");
            ivjDataButton.setToolTipText("Show data");
            ivjDataButton.setText("");
            ivjDataButton.setMaximumSize(new java.awt.Dimension(28, 28));
            ivjDataButton.setActionCommand("JPanelData");
            ivjDataButton.setIcon(VCellIcons.dataSetsIcon);
            ivjDataButton.setPreferredSize(new java.awt.Dimension(28, 28));
            ivjDataButton.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 ivjDataButton;
}
Also used : JToolBarToggleButton(org.vcell.util.gui.JToolBarToggleButton)

Example 18 with JToolBarToggleButton

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

the class PlotPane method getPlotButton.

/**
 * Return the PlotButton property value.
 * @return cbit.gui.JToolBarToggleButton
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private JToolBarToggleButton getPlotButton() {
    if (ivjPlotButton == null) {
        try {
            ivjPlotButton = new JToolBarToggleButton();
            ivjPlotButton.setName("PlotButton");
            ivjPlotButton.setToolTipText("Show plot(s)");
            ivjPlotButton.setText("");
            ivjPlotButton.setMaximumSize(new java.awt.Dimension(28, 28));
            ivjPlotButton.setActionCommand("JPanelPlot");
            ivjPlotButton.setSelected(true);
            ivjPlotButton.setPreferredSize(new java.awt.Dimension(28, 28));
            ivjPlotButton.setIcon(VCellIcons.dataExporterIcon);
            ivjPlotButton.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 ivjPlotButton;
}
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