⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bluecurveengine.java

📁 JAVA的一些源码 JAVA2 STANDARD EDITION DEVELOPMENT KIT 5.0
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
            if (shadowType == GTKConstants.SHADOW_OUT) {                innerLeft = style.getGTKColor(c, region, state,                                              BluecurveColorType.WHITE);                innerRight = style.getGTKColor(c, region, state,                                            BluecurveColorType.INNER_RIGHT2);            }            else {                innerLeft = style.getGTKColor(c, region, state,                                              BluecurveColorType.INNER_RIGHT2);                innerRight = style.getGTKColor(c, region, state,                                            BluecurveColorType.WHITE);            }        }        else if (info != "menuitem" && info != "bar") {            upperLeft = bottomRight = style.getGTKColor(c, region, state,                              BluecurveColorType.OUTER3);            if (shadowType == GTKConstants.SHADOW_OUT) {                innerLeft = style.getGTKColor(c, region, state,                                              BluecurveColorType.WHITE);                innerRight = style.getGTKColor(c, region, state,                                              BluecurveColorType.INNER_RIGHT2);            }            else {                innerLeft = style.getGTKColor(c, region, state,                                              BluecurveColorType.INNER_RIGHT2);                innerRight = style.getGTKColor(c, region, state,                                              BluecurveColorType.WHITE);            }        }        else {            upperLeft = bottomRight = style.getGTKColor(c, region,                 SynthConstants.SELECTED, BluecurveColorType.OUTER);            switch (shadowType) {            case GTKConstants.SHADOW_OUT:                innerLeft = style.getGTKColor(c, region,                     SynthConstants.SELECTED, BluecurveColorType.INNER_LEFT);                innerRight = style.getGTKColor(c, region,                     SynthConstants.SELECTED, BluecurveColorType.INNER_RIGHT);                break;            case GTKConstants.SHADOW_IN:                innerRight = style.getGTKColor(c, region,                     SynthConstants.SELECTED, BluecurveColorType.INNER_LEFT);                innerLeft = style.getGTKColor(c, region,                     SynthConstants.SELECTED, BluecurveColorType.INNER_RIGHT);                break;            default:                assert true : "Unknown shadow type!";            }        }        _paintShadow(g, x, y, w, h, xThickness, yThickness, upperLeft,                innerLeft, bottomRight, innerRight);        if (info == "menuitem" || info == "bar") {            // Draw the GradientPaint            int gw = Math.min(2, xThickness);            int gh = Math.min(2, yThickness);            Color topColor = style.getGTKColor(c, region,                  SynthConstants.SELECTED,BluecurveColorType. TOP_GRADIENT);            Color bottomColor = style.getGTKColor(c, region,                  SynthConstants.SELECTED,BluecurveColorType. BOTTOM_GRADIENT);            GradientPaint paint = new GradientPaint((float)gw, (float)gh,                       topColor, (float)gw, (float)(h - gh - gh), bottomColor);            g.translate(x, y);            ((Graphics2D)g).setPaint(paint);            g.fillRect(gw, gh, w - gw - gw, h - gh - gh);            ((Graphics2D)g).setPaint(null);            g.translate(-x, -y);        }    }    public void paintArrow(SynthContext context, Graphics g, int state,                           int shadowType, int direction, String info,                           int x, int y, int w, int h) {        // Draw the arrow        int sizeW = w / 4 + 1;        int sizeH = h / 4 + 1;        int size = Math.max(2, Math.min(sizeW, sizeH));        switch (direction) {        case GTKConstants.ARROW_UP:            x += w / 2 - 1;            y += (h - size) / 2;            break;        case GTKConstants.ARROW_DOWN:            x += w / 2 - 1;            y += (h - size) / 2 + 1;            break;        case GTKConstants.ARROW_LEFT:            x += (w - size) / 2;            y += h / 2 - 1;            break;        case GTKConstants.ARROW_RIGHT:            x += (w - size) / 2 + 1;            y += h / 2 - 1;            break;        }        GTKStyle style = (GTKStyle)context.getStyle();        int mid, i, j;        j = 0;        mid = (size / 2) - 1;        g.translate(x, y);        // PENDING: this isn't the right color.        g.setColor(style.getGTKColor(context.getComponent(),                   context.getRegion(), state, BluecurveColorType.OUTER5));        switch(direction) {        case GTKConstants.ARROW_UP:            for(i = 0; i < size; i++) {                g.drawLine(mid-i, i, mid+i, i);            }            g.fillRect(mid - size + 2, size, 1, 1);            g.fillRect(mid + size - 2, size, 1, 1);            break;        case GTKConstants.ARROW_DOWN:            j = 0;            for (i = size-1; i >= 0; i--) {                g.drawLine(mid-i, j, mid+i, j);                j++;            }            g.fillRect(mid - size + 2, -1, 1, 1);            g.fillRect(mid + size - 2, -1, 1, 1);            break;        case GTKConstants.ARROW_LEFT:            for (i = 0; i < size; i++) {                g.drawLine(i, mid-i, i, mid+i);            }            g.fillRect(size, mid - size + 2, 1, 1);            g.fillRect(size, mid + size - 2, 1, 1);            break;        case GTKConstants.ARROW_RIGHT:            j = 0;            for (i = size-1; i >= 0; i--)   {                g.drawLine(j, mid-i, j, mid+i);                j++;            }            g.fillRect(-1, mid - size + 2, 1, 1);            g.fillRect(-1, mid + size - 2, 1, 1);            break;        }        g.translate(-x, -y);	    }    public void paintHandle(SynthContext context, Graphics g, int paintState,                            int shadowType, String info, int x, int y,                            int w, int h, int orientation) {        paintHashes(context, g, paintState, x, y, w, h, orientation, 5, 4);    }    public void paintOption(SynthContext context, Graphics g, int paintState,                            int shadowType, String info, int x, int y,                            int w, int h) {        if (info == "option") {            int componentState = context.getComponentState();            if ((componentState & SynthConstants.SELECTED) != 0) {                g.translate(x, y);                int centerY = h / 2 - 1;                JComponent component = context.getComponent();                Region region = context.getRegion();                GTKStyle style = (GTKStyle)context.getStyle();                if ((componentState & SynthConstants.MOUSE_OVER) != 0) {                    g.setColor(style.getGTKColor(component, region, paintState,                                                 GTKColorType.WHITE));                }                else {                    g.setColor(style.getGTKColor(component, region, paintState,                                                 GTKColorType.BLACK));                }                g.fillRect(5, centerY, 5, 3);                g.drawLine(6, centerY - 1, 8, centerY - 1);                g.drawLine(6, centerY + 3, 8, centerY + 3);                g.translate(-x, -y);            }            return;        }        super.paintOption(context, g, paintState, shadowType, info, x, y,                          w, h);        if (info == "radiobutton") {            if ((context.getComponentState() & SynthConstants.SELECTED) != 0) {                // PENDING: this should be a gradient.                int centerY = h / 2 - 1;                g.translate(x, y);                g.setColor(((GTKStyle)context.getStyle()).getGTKColor(context.                           getComponent(), context.getRegion(), paintState,                           BluecurveColorType.OUTER));                g.fillRect(5, centerY, 5, 3);                g.drawLine(6, centerY - 1, 8, centerY - 1);                g.drawLine(6, centerY + 3, 8, centerY + 3);                g.translate(-x, -y);            }        }    }    public void paintExtension(SynthContext context, Graphics g, int state,                               int shadowType, String info, int x, int y,                               int w, int h, int placement, int tabIndex) {        _paintExtension(context, g, state, shadowType, x, y, w, h, placement,                   BluecurveColorType.OUTER3, GTKColorType.BACKGROUND,                   BluecurveColorType.OUTER3, BluecurveColorType.INNER_RIGHT2,                        true, tabIndex);    }    public void paintBoxGap(SynthContext context, Graphics g, int state,                            int shadowType, String info, int x, int y,                            int w, int h, int boxGapType, int tabBegin,                            int size) {        _paintBoxGap(context, g, state, shadowType, x, y, w, h, boxGapType,                     tabBegin, size, GTKColorType.BACKGROUND,                     BluecurveColorType.OUTER3, BluecurveColorType.OUTER3,                     BluecurveColorType.INNER_RIGHT2, true);    }    Color getFocusColor(SynthContext context, int state) {        return ((BluecurveStyle)context.getStyle()).getGTKColor(               context.getComponent(), context.getRegion(),               SynthConstants.SELECTED, BluecurveColorType.OUTER3);    }}

⌨️ 快捷键说明

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