jncursor.java

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

JAVA
98
字号
/*
 * $Id: JNCursor.java,v 1.5 2004/02/28 09:20:51 epr Exp $
 */
package org.jnode.wt.decorators;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Point;

/**
 * @author vali
 *
 * To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
public abstract class JNCursor implements org.jnode.wt.components.Decorator {
    private Point hotSpot = new Point(1, 1);
    private Dimension size = new Dimension(6, 6);
    private Image image = null;
    public static JNCursor ARROW_POINTER = new JNCursor() {
        public Image getImage() {
            return null;//Toolkit.getDefaultToolkit().getImage("f:\\arrow.jpg");
        }

    };

    public static JNCursor defaultCursor() {
        return ARROW_POINTER;
    }

    public void draw(Graphics g) {
        if (this.getImage() == null) {
            g.drawLine(
                    Math.round(this.getSize().width / 2),
                    0,
                    Math.round(this.getSize().width / 2),
                    this.getSize().height - 1);
            g.drawLine(
                    0,
                    Math.round(this.getSize().height / 2),
                    this.getSize().width - 1,
                    Math.round(this.getSize().height / 2));
        }
/*		else
			g.drawImage(
					getImage(),
					0,
					0,
					getImage().getWidth(),
					getImage().getHeight(),
					(ImageObserver)null);*/
    }

    /**
     * @return Returns the hotSpot.
     */
    public Point getHotSpot() {
        return this.hotSpot;
    }

    /**
     * @param hotSpot The hotSpot to set.
     */
    public void setHotSpot(Point hotSpot) {
        this.hotSpot = hotSpot;
    }

    /**
     * @return Returns the size.
     */
    public Dimension getSize() {
        return this.size;
    }

    /**
     * @param size The size to set.
     */
    public void setSize(Dimension size) {
        this.size = size;
    }

    /**
     * @return Returns the image.
     */
    public Image getImage() {
        return this.image;
    }

    /**
     * @param image The image to set.
     */
    public void setImage(Image image) {
        this.image = image;
    }

}

⌨️ 快捷键说明

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