radiobuttonpainter.java

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

JAVA
688
字号
    }

    private Ellipse2D decodeEllipse1() {        ellipse.setFrame(decodeX(0.4f), //x                         decodeY(0.4f), //y                         decodeX(2.6f) - decodeX(0.4f), //width                         decodeY(2.6f) - decodeY(0.4f)); //height        return ellipse;    }    private Ellipse2D decodeEllipse2() {        ellipse.setFrame(decodeX(0.6f), //x                         decodeY(0.6f), //y                         decodeX(2.4f) - decodeX(0.6f), //width                         decodeY(2.4f) - decodeY(0.6f)); //height        return ellipse;    }    private Ellipse2D decodeEllipse3() {        ellipse.setFrame(decodeX(0.4f), //x                         decodeY(0.6f), //y                         decodeX(2.6f) - decodeX(0.4f), //width                         decodeY(2.8f) - decodeY(0.6f)); //height        return ellipse;    }    private Ellipse2D decodeEllipse4() {        ellipse.setFrame(decodeX(0.120000005f), //x                         decodeY(0.120000005f), //y                         decodeX(2.8799999f) - decodeX(0.120000005f), //width                         decodeY(2.8799999f) - decodeY(0.120000005f)); //height        return ellipse;    }    private Ellipse2D decodeEllipse5() {        ellipse.setFrame(decodeX(1.125f), //x                         decodeY(1.125f), //y                         decodeX(1.875f) - decodeX(1.125f), //width                         decodeY(1.875f) - decodeY(1.125f)); //height        return ellipse;    }

    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.49789914f * w) + x, (-0.004201681f * h) + y, (0.5f * w) + x, (0.9978992f * 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.49754903f * w) + x, (0.004901961f * h) + y, (0.50735295f * w) + x, (1.0f * h) + y,                new float[] { 0.06344411f,0.21601209f,0.36858007f,0.54833835f,0.72809666f,0.77492446f,0.82175225f,0.91087615f,1.0f },                new Color[] { color3,                            decodeColor(color3,color4,0.5f),                            color4,                            decodeColor(color4,color4,0.5f),                            color4,                            decodeColor(color4,color5,0.5f),                            color5,                            decodeColor(color5,color6,0.5f),                            color6});    }    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.49789914f * w) + x, (-0.004201681f * h) + y, (0.5f * w) + x, (0.9978992f * h) + y,                new float[] { 0.0f,0.5f,1.0f },                new Color[] { color8,                            decodeColor(color8,color9,0.5f),                            color9});    }    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.49754903f * w) + x, (0.004901961f * h) + y, (0.50735295f * w) + x, (1.0f * h) + y,                new float[] { 0.06344411f,0.25009555f,0.43674698f,0.48042166f,0.52409637f,0.70481926f,0.88554215f },                new Color[] { color10,                            decodeColor(color10,color4,0.5f),                            color4,                            decodeColor(color4,color4,0.5f),                            color4,                            decodeColor(color4,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.49789914f * w) + x, (-0.004201681f * h) + y, (0.5f * w) + x, (0.9978992f * 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.49754903f * w) + x, (0.004901961f * h) + y, (0.50735295f * w) + x, (1.0f * h) + y,                new float[] { 0.06344411f,0.21601209f,0.36858007f,0.54833835f,0.72809666f,0.77492446f,0.82175225f,0.91087615f,1.0f },                new Color[] { color15,                            decodeColor(color15,color16,0.5f),                            color16,                            decodeColor(color16,color16,0.5f),                            color16,                            decodeColor(color16,color17,0.5f),                            color17,                            decodeColor(color17,color18,0.5f),                            color18});    }    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.49789914f * w) + x, (-0.004201681f * h) + y, (0.5f * w) + x, (0.9978992f * h) + y,                new float[] { 0.0f,0.5f,1.0f },                new Color[] { color20,                            decodeColor(color20,color21,0.5f),                            color21});    }    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.49754903f * w) + x, (0.004901961f * h) + y, (0.50735295f * w) + x, (1.0f * h) + y,                new float[] { 0.06344411f,0.20792687f,0.35240963f,0.45030123f,0.5481928f,0.748494f,0.9487952f },                new Color[] { color22,                            decodeColor(color22,color23,0.5f),                            color23,                            decodeColor(color23,color23,0.5f),                            color23,                            decodeColor(color23,color24,0.5f),                            color24});    }    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.49789914f * w) + x, (-0.004201681f * h) + y, (0.5f * w) + x, (0.9978992f * h) + y,                new float[] { 0.0f,0.5f,1.0f },                new Color[] { color25,                            decodeColor(color25,color26,0.5f),                            color26});    }    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.49754903f * w) + x, (0.004901961f * h) + y, (0.50735295f * w) + x, (1.0f * h) + y,                new float[] { 0.0813253f,0.100903615f,0.12048193f,0.28915662f,0.45783132f,0.6159638f,0.77409637f,0.82981926f,0.88554215f },                new Color[] { color27,                            decodeColor(color27,color28,0.5f),                            color28,                            decodeColor(color28,color29,0.5f),                            color29,                            decodeColor(color29,color29,0.5f),                            color29,                            decodeColor(color29,color30,0.5f),                            color30});    }    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.50490195f * w) + x, (0.0f * h) + y, (0.49509802f * w) + x, (1.0f * h) + y,                new float[] { 0.0f,0.23192771f,0.46385542f,0.73192775f,1.0f },                new Color[] { color31,                            decodeColor(color31,color32,0.5f),                            color32,                            decodeColor(color32,color33,0.5f),                            color33});    }    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.49789914f * w) + x, (-0.004201681f * h) + y, (0.5f * w) + x, (0.9978992f * h) + y,                new float[] { 0.0f,0.5f,1.0f },                new Color[] { color34,                            decodeColor(color34,color26,0.5f),                            color26});    }    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.49754903f * w) + x, (0.004901961f * h) + y, (0.50735295f * w) + x, (1.0f * h) + y,                new float[] { 0.039156627f,0.07831325f,0.11746988f,0.2876506f,0.45783132f,0.56174695f,0.66566265f,0.7756024f,0.88554215f },                new Color[] { color36,                            decodeColor(color36,color37,0.5f),                            color37,                            decodeColor(color37,color38,0.5f),                            color38,                            decodeColor(color38,color38,0.5f),                            color38,                            decodeColor(color38,color39,0.5f),                            color39});    }    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.50490195f * w) + x, (0.0f * h) + y, (0.49509802f * w) + x, (1.0f * h) + y,                new float[] { 0.0f,0.23192771f,0.46385542f,0.73192775f,1.0f },                new Color[] { color40,                            decodeColor(color40,color32,0.5f),                            color32,                            decodeColor(color32,color33,0.5f),                            color33});    }    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.49789914f * w) + x, (-0.004201681f * h) + y, (0.5f * w) + x, (0.9978992f * h) + y,                new float[] { 0.0f,0.5f,1.0f },                new Color[] { color41,                            decodeColor(color41,color42,0.5f),                            color42});    }    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.49754903f * w) + x, (0.004901961f * h) + y, (0.50735295f * w) + x, (1.0f * h) + y,                new float[] { 0.0813253f,0.100903615f,0.12048193f,0.20180723f,0.28313252f,0.49246985f,0.7018072f,0.7560241f,0.810241f,0.84789157f,0.88554215f },                new Color[] { color43,                            decodeColor(color43,color44,0.5f),                            color44,                            decodeColor(color44,color45,0.5f),                            color45,                            decodeColor(color45,color45,0.5f),                            color45,                            decodeColor(color45,color46,0.5f),                            color46,                            decodeColor(color46,color47,0.5f),                            color47});    }    private Paint decodeGradient17(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.49789914f * w) + x, (-0.004201681f * h) + y, (0.5f * w) + x, (0.9978992f * h) + y,                new float[] { 0.0f,0.5f,1.0f },                new Color[] { color48,                            decodeColor(color48,color49,0.5f),                            color49});    }    private Paint decodeGradient18(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.49754903f * w) + x, (0.004901961f * h) + y, (0.50735295f * w) + x, (1.0f * h) + y,                new float[] { 0.0813253f,0.2695783f,0.45783132f,0.67168677f,0.88554215f },                new Color[] { color50,                            decodeColor(color50,color51,0.5f),                            color51,                            decodeColor(color51,color52,0.5f),                            color52});    }    private Paint decodeGradient19(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.50490195f * w) + x, (0.0f * h) + y, (0.49509802f * w) + x, (1.0f * h) + y,                new float[] { 0.0f,0.23192771f,0.46385542f,0.73192775f,1.0f },                new Color[] { color53,                            decodeColor(color53,color54,0.5f),                            color54,                            decodeColor(color54,color55,0.5f),                            color55});    }
}

⌨️ 快捷键说明

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