checkboxpainter.java

来自「Mobile 应用程序使用 Java Micro Edition (Java M」· Java 代码 · 共 619 行 · 第 1/2 页

JAVA
619
字号
        g.fill(roundRect);        roundRect = decodeRoundRect1();        g.setPaint(decodeGradient13(roundRect));        g.fill(roundRect);        roundRect = decodeRoundRect2();        g.setPaint(decodeGradient14(roundRect));        g.fill(roundRect);        path = decodePath1();        g.setPaint(color28);        g.fill(path);    }    private void painticonDisabledAndSelected(Graphics2D g) {        roundRect = decodeRoundRect1();        g.setPaint(decodeGradient15(roundRect));        g.fill(roundRect);        roundRect = decodeRoundRect2();        g.setPaint(decodeGradient16(roundRect));        g.fill(roundRect);        path = decodePath1();        g.setPaint(color45);        g.fill(path);    }

    private RoundRectangle2D decodeRoundRect1() {        roundRect.setRoundRect(decodeX(0.4f), //x                               decodeY(0.4f), //y                               decodeX(2.6f) - decodeX(0.4f), //width                               decodeY(2.6f) - decodeY(0.4f), //height                               3.7058823f, 3.7058823f); //rounding        return roundRect;    }    private RoundRectangle2D decodeRoundRect2() {        roundRect.setRoundRect(decodeX(0.6f), //x                               decodeY(0.6f), //y                               decodeX(2.4f) - decodeX(0.6f), //width                               decodeY(2.4f) - decodeY(0.6f), //height                               3.764706f, 3.764706f); //rounding        return roundRect;    }    private RoundRectangle2D decodeRoundRect3() {        roundRect.setRoundRect(decodeX(0.4f), //x                               decodeY(1.75f), //y                               decodeX(2.6f) - decodeX(0.4f), //width                               decodeY(2.8f) - decodeY(1.75f), //height                               5.1764708f, 5.1764708f); //rounding        return roundRect;    }    private RoundRectangle2D decodeRoundRect4() {        roundRect.setRoundRect(decodeX(0.120000005f), //x                               decodeY(0.120000005f), //y                               decodeX(2.8799999f) - decodeX(0.120000005f), //width                               decodeY(2.8799999f) - decodeY(0.120000005f), //height                               8.0f, 8.0f); //rounding        return roundRect;    }    private Path2D decodePath1() {        path.reset();        path.moveTo(decodeX(1.0036764f), decodeY(1.382353f));        path.lineTo(decodeX(1.2536764f), decodeY(1.382353f));        path.lineTo(decodeX(1.430147f), decodeY(1.757353f));        path.lineTo(decodeX(1.8235294f), decodeY(0.62352943f));        path.lineTo(decodeX(2.2f), decodeY(0.61764705f));        path.lineTo(decodeX(1.492647f), decodeY(2.0058823f));        path.lineTo(decodeX(1.382353f), decodeY(2.0058823f));        path.lineTo(decodeX(1.0036764f), decodeY(1.382353f));        path.closePath();        return path;    }

    private Paint decodeGradient1(Shape s) {        Rectangle2D bounds = s.getBounds2D();        float x = (float)bounds.getX();        float y = (float)bounds.getY();        float w = (float)bounds.getWidth();        float h = (float)bounds.getHeight();        return decodeGradient((0.25f * w) + x, (0.0f * h) + y, (0.25210086f * w) + x, (0.9957983f * h) + y,                new float[] { 0.0f,0.5f,1.0f },                new Color[] { color1,                            decodeColor(color1,color2,0.5f),                            color2});    }    private Paint decodeGradient2(Shape s) {        Rectangle2D bounds = s.getBounds2D();        float x = (float)bounds.getX();        float y = (float)bounds.getY();        float w = (float)bounds.getWidth();        float h = (float)bounds.getHeight();        return decodeGradient((0.25f * w) + x, (0.0f * h) + y, (0.25f * w) + x, (0.997549f * h) + y,                new float[] { 0.0f,0.32228917f,0.64457834f,0.82228917f,1.0f },                new Color[] { color3,                            decodeColor(color3,color4,0.5f),                            color4,                            decodeColor(color4,color5,0.5f),                            color5});    }    private Paint decodeGradient3(Shape s) {        Rectangle2D bounds = s.getBounds2D();        float x = (float)bounds.getX();        float y = (float)bounds.getY();        float w = (float)bounds.getWidth();        float h = (float)bounds.getHeight();        return decodeGradient((0.25f * w) + x, (0.0f * h) + y, (0.25210086f * w) + x, (0.9957983f * h) + y,                new float[] { 0.0f,0.5f,1.0f },                new Color[] { color7,                            decodeColor(color7,color8,0.5f),                            color8});    }    private Paint decodeGradient4(Shape s) {        Rectangle2D bounds = s.getBounds2D();        float x = (float)bounds.getX();        float y = (float)bounds.getY();        float w = (float)bounds.getWidth();        float h = (float)bounds.getHeight();        return decodeGradient((0.25f * w) + x, (0.0f * h) + y, (0.25f * w) + x, (0.997549f * h) + y,                new float[] { 0.0f,0.32228917f,0.64457834f,0.82228917f,1.0f },                new Color[] { color9,                            decodeColor(color9,color10,0.5f),                            color10,                            decodeColor(color10,color11,0.5f),                            color11});    }    private Paint decodeGradient5(Shape s) {        Rectangle2D bounds = s.getBounds2D();        float x = (float)bounds.getX();        float y = (float)bounds.getY();        float w = (float)bounds.getWidth();        float h = (float)bounds.getHeight();        return decodeGradient((0.25f * w) + x, (0.0f * h) + y, (0.25210086f * w) + x, (0.9957983f * h) + y,                new float[] { 0.0f,0.5f,1.0f },                new Color[] { color13,                            decodeColor(color13,color14,0.5f),                            color14});    }    private Paint decodeGradient6(Shape s) {        Rectangle2D bounds = s.getBounds2D();        float x = (float)bounds.getX();        float y = (float)bounds.getY();        float w = (float)bounds.getWidth();        float h = (float)bounds.getHeight();        return decodeGradient((0.25f * w) + x, (0.0f * h) + y, (0.25f * w) + x, (0.997549f * h) + y,                new float[] { 0.0f,0.32228917f,0.64457834f,0.82228917f,1.0f },                new Color[] { color15,                            decodeColor(color15,color16,0.5f),                            color16,                            decodeColor(color16,color17,0.5f),                            color17});    }    private Paint decodeGradient7(Shape s) {        Rectangle2D bounds = s.getBounds2D();        float x = (float)bounds.getX();        float y = (float)bounds.getY();        float w = (float)bounds.getWidth();        float h = (float)bounds.getHeight();        return decodeGradient((0.25f * w) + x, (0.0f * h) + y, (0.25210086f * w) + x, (0.9957983f * h) + y,                new float[] { 0.0f,0.5f,1.0f },                new Color[] { color18,                            decodeColor(color18,color19,0.5f),                            color19});    }    private Paint decodeGradient8(Shape s) {        Rectangle2D bounds = s.getBounds2D();        float x = (float)bounds.getX();        float y = (float)bounds.getY();        float w = (float)bounds.getWidth();        float h = (float)bounds.getHeight();        return decodeGradient((0.25f * w) + x, (0.0f * h) + y, (0.25f * w) + x, (0.997549f * h) + y,                new float[] { 0.0f,0.32228917f,0.64457834f,0.82228917f,1.0f },                new Color[] { color20,                            decodeColor(color20,color21,0.5f),                            color21,                            decodeColor(color21,color22,0.5f),                            color22});    }    private Paint decodeGradient9(Shape s) {        Rectangle2D bounds = s.getBounds2D();        float x = (float)bounds.getX();        float y = (float)bounds.getY();        float w = (float)bounds.getWidth();        float h = (float)bounds.getHeight();        return decodeGradient((0.25f * w) + x, (0.0f * h) + y, (0.25210086f * w) + x, (0.9957983f * h) + y,                new float[] { 0.0f,0.5f,1.0f },                new Color[] { color23,                            decodeColor(color23,color24,0.5f),                            color24});    }    private Paint decodeGradient10(Shape s) {        Rectangle2D bounds = s.getBounds2D();        float x = (float)bounds.getX();        float y = (float)bounds.getY();        float w = (float)bounds.getWidth();        float h = (float)bounds.getHeight();        return decodeGradient((0.25f * w) + x, (0.0f * h) + y, (0.25f * w) + x, (0.997549f * h) + y,                new float[] { 0.0f,0.32228917f,0.64457834f,0.82228917f,1.0f },                new Color[] { color25,                            decodeColor(color25,color26,0.5f),                            color26,                            decodeColor(color26,color27,0.5f),                            color27});    }    private Paint decodeGradient11(Shape s) {        Rectangle2D bounds = s.getBounds2D();        float x = (float)bounds.getX();        float y = (float)bounds.getY();        float w = (float)bounds.getWidth();        float h = (float)bounds.getHeight();        return decodeGradient((0.25f * w) + x, (0.0f * h) + y, (0.25210086f * w) + x, (0.9957983f * h) + y,                new float[] { 0.0f,0.5f,1.0f },                new Color[] { color28,                            decodeColor(color28,color30,0.5f),                            color30});    }    private Paint decodeGradient12(Shape s) {        Rectangle2D bounds = s.getBounds2D();        float x = (float)bounds.getX();        float y = (float)bounds.getY();        float w = (float)bounds.getWidth();        float h = (float)bounds.getHeight();        return decodeGradient((0.25f * w) + x, (0.0f * h) + y, (0.25f * w) + x, (0.997549f * h) + y,                new float[] { 0.0f,0.05775076f,0.11550152f,0.38003993f,0.64457834f,0.82228917f,1.0f },                new Color[] { color31,                            decodeColor(color31,color32,0.5f),                            color32,                            decodeColor(color32,color33,0.5f),                            color33,                            decodeColor(color33,color34,0.5f),                            color34});    }    private Paint decodeGradient13(Shape s) {        Rectangle2D bounds = s.getBounds2D();        float x = (float)bounds.getX();        float y = (float)bounds.getY();        float w = (float)bounds.getWidth();        float h = (float)bounds.getHeight();        return decodeGradient((0.25f * w) + x, (0.0f * h) + y, (0.25210086f * w) + x, (0.9957983f * h) + y,                new float[] { 0.0f,0.5f,1.0f },                new Color[] { color35,                            decodeColor(color35,color36,0.5f),                            color36});    }    private Paint decodeGradient14(Shape s) {        Rectangle2D bounds = s.getBounds2D();        float x = (float)bounds.getX();        float y = (float)bounds.getY();        float w = (float)bounds.getWidth();        float h = (float)bounds.getHeight();        return decodeGradient((0.25f * w) + x, (0.0f * h) + y, (0.25f * w) + x, (0.997549f * h) + y,                new float[] { 0.0f,0.32228917f,0.64457834f,0.82228917f,1.0f },                new Color[] { color37,                            decodeColor(color37,color38,0.5f),                            color38,                            decodeColor(color38,color39,0.5f),                            color39});    }    private Paint decodeGradient15(Shape s) {        Rectangle2D bounds = s.getBounds2D();        float x = (float)bounds.getX();        float y = (float)bounds.getY();        float w = (float)bounds.getWidth();        float h = (float)bounds.getHeight();        return decodeGradient((0.25f * w) + x, (0.0f * h) + y, (0.25210086f * w) + x, (0.9957983f * h) + y,                new float[] { 0.0f,0.5f,1.0f },                new Color[] { color40,                            decodeColor(color40,color41,0.5f),                            color41});    }    private Paint decodeGradient16(Shape s) {        Rectangle2D bounds = s.getBounds2D();        float x = (float)bounds.getX();        float y = (float)bounds.getY();        float w = (float)bounds.getWidth();        float h = (float)bounds.getHeight();        return decodeGradient((0.25f * w) + x, (0.0f * h) + y, (0.25f * w) + x, (0.997549f * h) + y,                new float[] { 0.0f,0.32228917f,0.64457834f,0.82228917f,1.0f },                new Color[] { color42,                            decodeColor(color42,color43,0.5f),                            color43,                            decodeColor(color43,color44,0.5f),                            color44});    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?