📄 zpen.java
字号:
/*
* Copyright 2002 EZCell , Inc. All rights reserved.
* Version 1.0.
* Author W.John
*/
package ezcell;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics2D;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
/**
* DOCUMENT ME!
*
* @version 1.00
* @author W.John
*/
public class ZPen implements Serializable, Cloneable {
/**
* put your documentation comment here
* @param zorder
*/
static float[] dash = { 5, 1 };
private Color color;
private int width;
private int zorder;
/**
* put your documentation comment here
*/
public ZPen() {
}
/**
* put your documentation comment here
* @param int width
* @param Color color
*/
public ZPen(int width, Color color) {
this.color = color;
this.width = width;
}
/**
* put your documentation comment here
* @param color
*/
public void setColor(Color color) {
this.color = color;
}
/**
* put your documentation comment here
* @return
*/
public Color getColor() {
return new Color(color.getRGB());
}
/**
* put your documentation comment here
* @param width
*/
public void setWidth(int width) {
this.width = width;
}
/**
* put your documentation comment here
* @return
*/
public int getWidth() {
return width;
}
/**
*
* @param zorder
*/
public void setZorder(int zorder) {
this.zorder = zorder;
}
/**
* put your documentation comment here
* @return
*/
public int getZorder() {
return zorder;
}
/**
*
* @return
*/
public Object clone() {
ZPen pen = null;
try {
pen = (ZPen) super.clone();
pen.color = new Color(color.getRGB());
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
return pen;
}
/**
*
* @param g2
*/
public void paint(Graphics2D g2) {
g2.setColor(color);
g2.setStroke(new BasicStroke(width)); //,BasicStroke.CAP_BUTT,BasicStroke.JOIN_MITER,1,dash,0));
}
/**
* put your documentation comment here
* @param ois
* @exception ClassNotFoundException, IOException
*/
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
ois.defaultReadObject();
}
/**
* put your documentation comment here
* @param oos
* @exception IOException
*/
private void writeObject(ObjectOutputStream oos) throws IOException {
oos.defaultWriteObject();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -