1323 lines · 42.1 KB · Java
RawDownload
    protected void setFontMetrics(FontMetrics fm) {        this.fm = fm;    }     protected void setAccFontMetrics(FontMetrics accFm) {        this.accFm = accFm;    }     protected void setIcon(Icon icon) {        this.icon = icon;    }     protected void setCheckIcon(Icon checkIcon) {        this.checkIcon = checkIcon;    }     protected void setArrowIcon(Icon arrowIcon) {        this.arrowIcon = arrowIcon;    }     protected void setText(String text) {        this.text = text;    }     protected void setAccText(String accText) {        this.accText = accText;    }     protected void setColumnLayout(boolean columnLayout) {        isColumnLayout = columnLayout;    }     protected void setUseCheckAndArrow(boolean useCheckAndArrow) {        this.useCheckAndArrow = useCheckAndArrow;    }     protected void setLeftToRight(boolean leftToRight) {        isLeftToRight = leftToRight;    }     protected void setTopLevelMenu(boolean topLevelMenu) {        isTopLevelMenu = topLevelMenu;    }     protected void setHtmlView(View htmlView) {        this.htmlView = htmlView;    }     protected void setVerticalAlignment(int verticalAlignment) {        this.verticalAlignment = verticalAlignment;    }     protected void setHorizontalAlignment(int horizontalAlignment) {        this.horizontalAlignment = horizontalAlignment;    }     protected void setVerticalTextPosition(int verticalTextPosition) {        this.verticalTextPosition = verticalTextPosition;    }     protected void setHorizontalTextPosition(int horizontalTextPosition) {        this.horizontalTextPosition = horizontalTextPosition;    }     protected void setGap(int gap) {        this.gap = gap;    }     protected void setLeadingGap(int leadingGap) {        this.leadingGap = leadingGap;    }     protected void setAfterCheckIconGap(int afterCheckIconGap) {        this.afterCheckIconGap = afterCheckIconGap;    }     protected void setMinTextOffset(int minTextOffset) {        this.minTextOffset = minTextOffset;    }     protected void setViewRect(Rectangle viewRect) {        this.viewRect = viewRect;    }     protected void setIconSize(RectSize iconSize) {        this.iconSize = iconSize;    }     protected void setTextSize(RectSize textSize) {        this.textSize = textSize;    }     protected void setAccSize(RectSize accSize) {        this.accSize = accSize;    }     protected void setCheckSize(RectSize checkSize) {        this.checkSize = checkSize;    }     protected void setArrowSize(RectSize arrowSize) {        this.arrowSize = arrowSize;    }     protected void setLabelSize(RectSize labelSize) {        this.labelSize = labelSize;    }     public int getLeftTextExtraWidth() {        return leftTextExtraWidth;    }     /**     * Returns false if the component is a JMenu and it is a top     * level menu (on the menubar).     */    public static boolean useCheckAndArrow(JMenuItem menuItem) {        boolean b = true;        if ((menuItem instanceof JMenu) &&                (((JMenu) menuItem).isTopLevelMenu())) {            b = false;        }        return b;    }     public static class LayoutResult {        private Rectangle iconRect;        private Rectangle textRect;        private Rectangle accRect;        private Rectangle checkRect;        private Rectangle arrowRect;        private Rectangle labelRect;         public LayoutResult() {            iconRect = new Rectangle();            textRect = new Rectangle();            accRect = new Rectangle();            checkRect = new Rectangle();            arrowRect = new Rectangle();            labelRect = new Rectangle();        }         public LayoutResult(Rectangle iconRect, Rectangle textRect,                            Rectangle accRect, Rectangle checkRect,                            Rectangle arrowRect, Rectangle labelRect) {            this.iconRect = iconRect;            this.textRect = textRect;            this.accRect = accRect;            this.checkRect = checkRect;            this.arrowRect = arrowRect;            this.labelRect = labelRect;        }         public Rectangle getIconRect() {            return iconRect;        }         public void setIconRect(Rectangle iconRect) {            this.iconRect = iconRect;        }         public Rectangle getTextRect() {            return textRect;        }         public void setTextRect(Rectangle textRect) {            this.textRect = textRect;        }         public Rectangle getAccRect() {            return accRect;        }         public void setAccRect(Rectangle accRect) {            this.accRect = accRect;        }         public Rectangle getCheckRect() {            return checkRect;        }         public void setCheckRect(Rectangle checkRect) {            this.checkRect = checkRect;        }         public Rectangle getArrowRect() {            return arrowRect;        }         public void setArrowRect(Rectangle arrowRect) {            this.arrowRect = arrowRect;        }         public Rectangle getLabelRect() {            return labelRect;        }         public void setLabelRect(Rectangle labelRect) {            this.labelRect = labelRect;        }         public Map<String, Rectangle> getAllRects() {            Map<String, Rectangle> result = new HashMap<String, Rectangle>();            result.put("checkRect", checkRect);            result.put("iconRect", iconRect);            result.put("textRect", textRect);            result.put("accRect", accRect);            result.put("arrowRect", arrowRect);            result.put("labelRect", labelRect);            return result;        }    }     public static class ColumnAlignment {        private int checkAlignment;        private int iconAlignment;        private int textAlignment;        private int accAlignment;        private int arrowAlignment;         public static final ColumnAlignment LEFT_ALIGNMENT =                new ColumnAlignment(                        SwingConstants.LEFT,                        SwingConstants.LEFT,                        SwingConstants.LEFT,                        SwingConstants.LEFT,                        SwingConstants.LEFT                );         public static final ColumnAlignment RIGHT_ALIGNMENT =                new ColumnAlignment(                        SwingConstants.RIGHT,                        SwingConstants.RIGHT,                        SwingConstants.RIGHT,                        SwingConstants.RIGHT,                        SwingConstants.RIGHT                );         public ColumnAlignment(int checkAlignment, int iconAlignment,                               int textAlignment, int accAlignment,                               int arrowAlignment) {            this.checkAlignment = checkAlignment;            this.iconAlignment = iconAlignment;            this.textAlignment = textAlignment;            this.accAlignment = accAlignment;            this.arrowAlignment = arrowAlignment;        }         public int getCheckAlignment() {            return checkAlignment;        }         public int getIconAlignment() {            return iconAlignment;        }         public int getTextAlignment() {            return textAlignment;        }         public int getAccAlignment() {            return accAlignment;        }         public int getArrowAlignment() {            return arrowAlignment;        }    }     public static class RectSize {        private int width;        private int height;        private int origWidth;        private int maxWidth;         public RectSize() {        }         public RectSize(int width, int height, int origWidth, int maxWidth) {            this.width = width;            this.height = height;            this.origWidth = origWidth;            this.maxWidth = maxWidth;        }         public int getWidth() {            return width;        }         public int getHeight() {            return height;        }         public int getOrigWidth() {            return origWidth;        }         public int getMaxWidth() {            return maxWidth;        }         public void setWidth(int width) {            this.width = width;        }         public void setHeight(int height) {            this.height = height;        }         public void setOrigWidth(int origWidth) {            this.origWidth = origWidth;        }         public void setMaxWidth(int maxWidth) {            this.maxWidth = maxWidth;        }         public String toString() {            return "[w=" + width + ",h=" + height + ",ow="                    + origWidth + ",mw=" + maxWidth + "]";        }    }}

Lines 1001–1323 of 1323. Previous lines