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

📄 simplebasisamsborder.java

📁 This is a resource based on j2me embedded,if you dont understand,you can connection with me .
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
        minMargin = Math.min(minMargin, rightMargin);    }    /**     * Sets all margins (top, left, bottom, and right) to the same, given value.     *     * @param margin         the margin     */    public synchronized void setMargins(int margin) {        topMargin = margin;        leftMargin = margin;        bottomMargin = margin;        rightMargin = margin;        resetMinMaxMargin();    }    /**     * Sets all margins (top, left, bottom, and right) to the given values.     *     * @param top           the top margin     * @param left          the left margin     * @param bottom        the bottom margin     * @param right         the right margin     */    public synchronized void setMargins(int top, int left, int bottom,                                        int right) {        topMargin = top;        leftMargin = left;        bottomMargin = bottom;        rightMargin = right;        resetMinMaxMargin();    }    /**     * Sets the top margin     *     * @param top           the top margin     */    /*    public synchronized void setTopMargin(int margin) {        topMargin = margin;        resetMinMaxMargin();    }*/    /**     * Sets the left margin     *     * @param left          the left margin     *//*    public synchronized void setLeftMargin(int margin) {        leftMargin = margin;        resetMinMaxMargin();    }*/    /**     * Sets the bottom margin     *     * @param bottom        the bottom margin     *//*    public synchronized void setBottomMargin(int margin) {        bottomMargin = margin;        resetMinMaxMargin();    }*/    /**     * Sets the right margin     *     * @param right         the right margin     *//*    public synchronized void setRightMargin(int margin) {        rightMargin = margin;        resetMinMaxMargin();    }*/    /**     * Returns the current setting for the JUMPGuiAMSBorder thickness     *     * @return    the JUMPGuiAMSBorder thickness     *//*    public int getJUMPGuiAMSBorderThickness() {        return JUMPGuiAMSBorderThickness;    }*/    /**     * Sets the SimpleBasisAMSBorder thickness     *      * @param JUMPGuiAMSBorderThickness         the SimpleBasisAMSBorder thickness     */    public synchronized void setJUMPGuiAMSBorderThickness(int JUMPGuiAMSBorderThickness) {        this.JUMPGuiAMSBorderThickness = JUMPGuiAMSBorderThickness;    }    /**     * returns the left, right, top, and bottom insets of the background of the     * current style, taking into account thickness and margins.     *     * @return  an Insets object containing the inset values     */    public Insets getInsets() {        int top = JUMPGuiAMSBorderThickness + topMargin;        int left = JUMPGuiAMSBorderThickness + leftMargin;        int bottom = JUMPGuiAMSBorderThickness + bottomMargin;        int right = JUMPGuiAMSBorderThickness + rightMargin;        return new Insets(top, left, bottom, right);    }    /**     * returns the left, right, top, and bottom insets of the background of the     * current style, taking into account thickness and margins.     *      * @param g           the Graphics in which to paint     * @param background  the current background color (or null), used if available to     *                      calculate the SimpleBasisAMSBorder color if that is null.     * @param x           the x location of the upper-left point of the SimpleBasisAMSBorder     * @param y           the y location of the upper-left point of the SimpleBasisAMSBorder     * @param width       the width of the rectangle in which to draw the SimpleBasisAMSBorder     * @param height      the height of the rectangle in which to draw the SimpleBasisAMSBorder     */    public void paint(Graphics g, Color background, int x, int y, int width,                      int height) {        if (JUMPGuiAMSBorder == null) {            if ( (type == LINE) ||                (type == ROUND_RECT)) {                if (background == Color.black) {                    JUMPGuiAMSBorder = Color.white;                }                else {                    JUMPGuiAMSBorder = Color.black;                }            }            else {                if (background == null) {                    JUMPGuiAMSBorder = Color.lightGray;                }                else {                    JUMPGuiAMSBorder = background;                }            }        }        if (JUMPGuiAMSBorder != null) {            g.setColor(JUMPGuiAMSBorder);            Color brighter = null;            Color darker = null;            switch (type) {                case THREED_IN:                case THREED_OUT:                case ETCHED_IN:                case EMBOSSED_OUT: {                    brighter = brighter(JUMPGuiAMSBorder);                    darker = darker(JUMPGuiAMSBorder);                    break;                }            }            for (int idx = 0; idx < JUMPGuiAMSBorderThickness; idx++) {                if (type == LINE) {                    g.drawRect(x + idx, y + idx,                               ( (width - 1) - (idx * 2)),                               ( (height - 1) - (idx * 2)));                }                else if (type == ROUND_RECT) {                    int arcSize = (minMargin * 8 - (idx * 2));                    int rrx = x + idx;                    int rry = y + idx;                    int rrw = (width - 1) - (idx * 2);                    int rrh = (height - 1) - (idx * 2);                    g.drawRoundRect(x + idx, y + idx, rrw, rrh, arcSize,                                    arcSize);                    if ( (idx + 1) < JUMPGuiAMSBorderThickness) {                        g.drawRoundRect(rrx, rry, rrw, rrh - 1, arcSize - 1,                                        arcSize);                        g.drawRoundRect(rrx + 1, rry, rrw, rrh - 1, arcSize - 1,                                        arcSize);                        g.drawRoundRect(rrx, rry, rrw - 1, rrh, arcSize,                                        arcSize - 1);                        g.drawRoundRect(rrx, rry + 1, rrw - 1, rrh, arcSize,                                        arcSize - 1);                    }                }                else {                    Color top = brighter;                    Color bottom = darker;                    if ( (type == THREED_IN) ||                        (type == ETCHED_IN)) {                        top = darker;                        bottom = brighter;                    }                    if ( (type == ETCHED_IN) ||                        (type == EMBOSSED_OUT)) {                        if (idx >= (JUMPGuiAMSBorderThickness / 2)) {                            Color temp = top;                            top = bottom;                            bottom = temp;                        }                    }                    if ( (idx == (JUMPGuiAMSBorderThickness - 1)) &&                        (type == THREED_IN)) {                        g.setColor(darker(top));                    }                    else {                        g.setColor(top);                    }                    g.drawLine(x + idx, y + idx,                               x + idx,                               y + ( (height - 1) - (idx)));                    g.drawLine(x + idx, y + idx,                               x + ( (width - 1) - (idx)),                               y + idx);                    if ( ( (idx == (JUMPGuiAMSBorderThickness - 1)) &&                          (type == THREED_IN)) ||                        ( (idx == 0) &&                         (type == THREED_OUT))) {                        g.setColor(darker(bottom));                    }                    else {                        g.setColor(bottom);                    }                    g.drawLine(x + idx,                               y + ( (height - 1) - (idx)),                               x + ( (width - 1) - (idx)),                               y + ( (height - 1) - (idx)));                    g.drawLine(x + ( (width - 1) - (idx)),                               y + idx,                               x + ( (width - 1) - (idx)),                               y + ( (height - 1) - (idx)));                }            }        }    }}

⌨️ 快捷键说明

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