jnborderfactory.java

来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 70 行

JAVA
70
字号
/*
 * $Id: JNBorderFactory.java,v 1.5 2004/02/26 21:17:15 lsantha Exp $
 */
package org.jnode.wt.decorators;

import java.awt.Color;
import java.awt.Graphics;

/**
 * @author vali
 *
 * To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
public class JNBorderFactory {
    public static int SINGLE_LINE_BORDER = 1;

    private static class SingleLineBorder extends AbstractDecorator implements BorderDecorator {

        private Color baseColor = Color.BLACK;

        public SingleLineBorder() {
            super();
        }

        public int getLeftDepth() {
            return 1;
        }

        public int getRightDepth() {
            return 1;
        }

        public int getTopDepth() {
            return 1;
        }

        public int getBottomDepth() {
            return 1;
        }

        public void draw(Graphics g) {
            g.setColor(baseColor);
            g.drawRect(
                    0,
                    0,
                    parent.getSize().width,
                    parent.getSize().height);

        }

        /* (non-Javadoc)
         * @see org.jnode.wt.decorators.BorderDecorator#setBaseCollor(java.awt.Color)
         */
        public void setBaseCollor(Color c) {
            baseColor = c;

        }

    }

    public static BorderDecorator getBorderDecorator(int type) {
        if (type == SINGLE_LINE_BORDER) {
            return new SingleLineBorder();
        }
        return null;
    }

}

⌨️ 快捷键说明

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