JAVA 动态创建风水罗盘 - 项目源码篇
**其实次项目设计关键在于此POJO实体类,它是整个项目的核心所在,虽然看着简单,但是整个数据如何处理,如何控制,如何绘制就在此类.贯穿了整个项目从swing前台到后台,创建具体绘制工厂与策略.
毫不客气的 PanelDiskBean 是次项目的中心思想. 有时候我们项目不知道如何定义,如何具体处理就在于整个项目串联中不够清楚,此类也是经过很多次调整和重新定义才能完美实现的.
好的程序和项目并不一定开始就很完美,只能最终实现和完成才能定型. 设计的再好总有不足之处就是因为设计太死,实现起来太不灵活了.只有千锤百炼才能成为一件完美的作品.如果你手上感觉在做一件作品,那其实已经脱离了编程,已经提升了一层.
如果你认为手上在做一件产品或者废品,那么就只是在码阿拉伯数字.未来的世界都是创新中走出来一条路,码多了路终究有一天也消失了.因为没有了核心所在.**
package com.compass;
public class PanelDiskBean {
private JPanel panel;
private Graphics2D g;
/** 绘制文本(图像...)参数 **/
private List<String> text;
/** 文本字体 **/
private UserFont textFont;
/** 圆心X坐标 **/
private int x;
/** 圆心Y坐标 **/
private int y;
/** 绘制区域开始大小 **/
private int start;
/** 绘制区域增量 **/
private int increment;
/** 绘制分割线数量 **/
private int size;
/** 绘制线偏移量 **/
private float line;
/** 角度偏移量 **/
private double deviation;
/** 分度盘间隔 **/
private int remainder;
public PanelDiskBean() {
}
public PanelDiskBean(JPanel panel, Graphics2D g, List<String> text, UserFont textFont, int x, int y, int start, int increment, int size,
float line, double deviation, int remainder) {
this.panel = panel;
this.g = g;
this.text = text;
this.textFont = textFont;
this.x = x;
this.y = y;
this.start = start;
this.increment = increment;
this.size = size;
this.line = line;
this.deviation = deviation;
this.remainder = remainder;
}
public JPanel getPanel() {
return panel;
}
public void setPanel(JPanel panel) {
this.panel = panel;
}
public Graphics2D getG() {
return g;
}
public void setG(Graphics2D g) {
this.g = g;
}
public List<String> getText() {
return text;
}
public void setText(List<String> text) {
this.text = text;
}
public UserFont getTextFont() {
return textFont;
}
public void setTextFont(UserFont textFont) {
this.textFont = textFont;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public int getStart() {
return start;
}
public void setStart(int start) {
this.start = start;
}
public int getIncrement() {
return increment;
}
public void setIncrement(int increment) {
this.increment = increment;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
public float getLine() {
return line;
}
public void setLine(float line) {
this.line = line;
}
public double getDeviation() {
return deviation;
}
public void setDeviation(double deviation) {
this.deviation = deviation;
}
public int getRemainder() {
return remainder;
}
public void setRemainder(int remainder) {
this.remainder = remainder;
}
}
时间: 2024-10-14 06:23:06