pixmapstyle.java

来自「JAVA的一些源码 JAVA2 STANDARD EDITION DEVELO」· Java 代码 · 共 542 行 · 第 1/2 页

JAVA
542
字号
        }        public Insets getOverlayInsets() {            return overlayInsets;        }        public boolean getOverlayStretch() {            return overlayStretch;        }        public int getArrowDirection() {            return arrowDirection;        }        public int getOrientation() {            return orientation;        }        private Image getImage(final Object o) {            if (o == null || o instanceof Image) {                return (Image)o;            }            ImageIcon ii = (ImageIcon)AccessController.doPrivileged(new PrivilegedAction() {                public Object run() {                    return new ImageIcon((String)o);                }            });            if (ii.getIconWidth() > 0 && ii.getIconHeight() > 0) {                return ii.getImage();            }                        return null;        }        /**         * Will return < 0 if doesn't match, otherwise return the         * number of parameters that match.         */        int getMatchCount(String detail, int componentState, int shadow,                          int orientation, int gapSide, int arrowDirection) {            int matchCount = 0;            if (this.componentState != UNDEFINED) {                if (componentState != UNDEFINED &&                             this.componentState != componentState) {                    return -1;                }                matchCount++;            }            if (this.shadow != UNDEFINED) {                if (shadow != UNDEFINED && this.shadow != shadow) {                    return -1;                }                matchCount++;            }            if (this.orientation != UNDEFINED) {                if (orientation != UNDEFINED &&                                   this.orientation != orientation) {                    return -1;                }                matchCount++;            }            if (this.gapSide != UNDEFINED) {                if (gapSide != UNDEFINED && this.gapSide != gapSide) {                    return -1;                }                matchCount++;            }            if (this.arrowDirection != UNDEFINED) {                if (arrowDirection != UNDEFINED &&                                      this.arrowDirection != arrowDirection) {                    return -1;                }                matchCount++;            }            if (this.detail != null) {                if (this.detail != detail) {                    return -1;                }                matchCount++;            }            return matchCount;        }        /**         * Returns true if this Info matches that of the passed in Info.         * This differs from equals in so far as this only compares the         * properties that are used in lookup vs the actual images or         * insets.         *         * @return true if the receiver and info can be considered equal         *         for lookup.         */        boolean matches(Info info) {            return (info.function == function && info.detail == detail &&                    info.componentState == componentState &&                    info.shadow == shadow && info.gapSide == gapSide &&                    info.arrowDirection == arrowDirection &&                    info.orientation == orientation);        }        public String toString() {            StringBuffer buf = new StringBuffer();            buf.append("IMAGE:\n");            if (function != null) {                buf.append("    function=").append(function).append('\n');            }            if (detail != null) {                buf.append("    detail=").append(detail).append('\n');            }            if (gapSide != UNDEFINED) {                buf.append("    gapSide=");                buf.append(getSideName(gapSide)).append('\n');            }            if (orientation != UNDEFINED) {                buf.append("    orientation=");                buf.append(getOrientName(orientation)).append('\n');            }            if (componentState != UNDEFINED) {                buf.append("    componentState=");                buf.append(getStateName(componentState, "UNDEFINED")).append('\n');            }            if (shadow != UNDEFINED) {                buf.append("    shadow=");                buf.append(getShadowName(shadow)).append('\n');            }            if (arrowDirection != UNDEFINED) {                buf.append("    arrowDirection=");                buf.append(getArrowDirectionName(arrowDirection)).append('\n');            }            if (recolorable != false) {                buf.append("    recolorable=").append(recolorable).append('\n');            }            if (image != null) {                buf.append("    image=").append(image).append('\n');            }            if (fileInsets != null) {                buf.append("    fileInsets=").append(fileInsets).append('\n');            }            if (stretch != false) {                buf.append("    stretch=").append(stretch).append('\n');            }            if (overlayImage != null) {                buf.append("    overlayImage=").append(overlayImage).append('\n');            }            if (overlayInsets != null) {                buf.append("    overlayInsets=").append(overlayInsets).append('\n');            }            if (overlayStretch != false) {                buf.append("    overlayStretch=").append(overlayStretch).append('\n');            }            if (gapStartImage != null) {                buf.append("    gapStartImage=").append(gapStartImage).append('\n');            }            if (gapStartInsets != null) {                buf.append("    gapStartInsets=").append(gapStartInsets).append('\n');            }            if (gapImage != null) {                buf.append("    gapImage=").append(gapImage).append('\n');            }            if (gapInsets != null) {                buf.append("    gapInsets=").append(gapInsets).append('\n');            }            if (gapEndImage != null) {                buf.append("    gapEndImage=").append(gapEndImage).append('\n');            }            if (gapEndInsets != null) {                buf.append("    gapEndInsets=").append(gapEndInsets).append('\n');            }            buf.deleteCharAt(buf.length() - 1);            return buf.toString();        }                private static String getSideName(int side) {            switch(side) {                case TOP: return "TOP";                case BOTTOM: return "BOTTOM";                case LEFT: return "LEFT";                case RIGHT: return "RIGHT";                case UNDEFINED: return "UNDEFINED";            }                        return "UNKNOWN";        }                private static String getOrientName(int orient) {            switch(orient) {                case HORIZONTAL: return "HORIZONTAL";                case VERTICAL: return "VERTICAL";                case UNDEFINED: return "UNDEFINED";            }                        return "UNKNOWN";        }                private static String getShadowName(int shadow) {            switch(shadow) {                case SHADOW_IN: return "SHADOW_IN";                case SHADOW_OUT: return "SHADOW_OUT";                case SHADOW_ETCHED_IN: return "SHADOW_ETCHED_IN";                case SHADOW_ETCHED_OUT: return "SHADOW_ETCHED_OUT";                case SHADOW_NONE: return "SHADOW_NONE";                case UNDEFINED: return "UNDEFINED";            }                        return "UNKNOWN";        }        private static String getArrowDirectionName(int dir) {            switch(dir) {                case ARROW_UP: return "ARROW_UP";                case ARROW_DOWN: return "ARROW_DOWN";                case ARROW_LEFT: return "ARROW_LEFT";                case ARROW_RIGHT: return "ARROW_RIGHT";                case UNDEFINED: return "UNDEFINED";            }            return "UNKNOWN";        }    }    public String toString() {        if (info == null) {            return super.toString();        } else {            StringBuffer buf = new StringBuffer(super.toString());                        if (buf.length() > 0) {                buf.append('\n');            }            buf.append("*** Pixmap Engine Info ***\n");            for (int i = 0; i < info.length; i++) {                buf.append(info[i].toString()).append('\n');            }            // remove last newline            buf.deleteCharAt(buf.length() - 1);                        return buf.toString();        }    }}

⌨️ 快捷键说明

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