JAVA注释帮忙加一下,越多行越好~

A198905011 2010-09-03 12:23:26
尽量多的加注释使行数增加,顺便可以修改下程序,时间紧迫,谢谢啦!!!
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package javadraw;


import java.awt.*;

import java.awt.event.MouseEvent;

import java.awt.geom.AffineTransform;


/**
*
* @author Anj
*/
//所有对象的父类 存储共享的类型信息

public abstract class RectBoundedShape implements IShape {


protected Color fore, back;

protected int isFilled;

protected Stroke stroke;

public AffineTransform at;

public float startX, startY, endX, endY;

protected String text = new String();

public Font f = new Font("Arial", 0, 50);


protected RectBoundedShape(int fi, Color c, Color d, Stroke s, int x, int y,String textcontent,Font font) {
fore = c;
back = d;
isFilled = fi;
stroke = s;
startX = endX = x;
startY = endY = y;
at = new AffineTransform();
text = textcontent;
f = font;
}

protected RectBoundedShape(){
at = new AffineTransform();
}

public void processCursorEvent(MouseEvent e) {

int x = e.getX();
int y = e.getY();
if (e.isShiftDown()) {
regulateShape(x, y);
} else {
endX = x;
endY = y;
}
}

protected void regulateShape(int x, int y) {
float w = x - startX;
float h = y - startY;
int s = (int) Math.min(Math.abs(w), Math.abs(h));
if (s == 0) {
endX = startX;
endY = startY;
} else {
endX = startX + s * (w / Math.abs(w));
endY = startY + s * (h / Math.abs(h));
}
}
//写入对象 把对象信息写入字符串

public String getShapeData() {

int si = 0;

for (int i = 0; i < DrawingBoard.STROKES.length; i++) {

if (stroke == DrawingBoard.STROKES[i]) {

si = i;
break;
}
}

StringBuffer buffer = new StringBuffer();

buffer.append(isFilled);

buffer.append(";");

buffer.append(fore.getRGB());

buffer.append(";");

buffer.append(back.getRGB());
b
uffer.append(";");

buffer.append(si);

buffer.append(";");

buffer.append(startX);

buffer.append(";");

buffer.append(startY);

buffer.append(";");

buffer.append(endX);

buffer.append(";");

buffer.append(endY);

buffer.append(";");

buffer.append(text);

buffer.append(";");

buffer.append(f.getFontName());

buffer.append(";");

buffer.append((int)f.getStyle());

buffer.append(";");

buffer.append(f.getSize());

buffer.append(";");

buffer.append(at.getScaleX());

buffer.append(";");

buffer.append(at.getScaleY());

buffer.append(";");

buffer.append(at.getShearX());

buffer.append(";");

buffer.append(at.getShearY());

buffer.append(";");

buffer.append(at.getTranslateX());

buffer.append(";");

buffer.append(at.getTranslateY());

return buffer.toString();
}
//从字符串中读取对象信息

public void setShapeData(String data) throws Exception {

String[] splits = data.split(";");

isFilled = Integer.parseInt(splits[0]);

fore = new Color(Integer.parseInt(splits[1]));

back = new Color(Integer.parseInt(splits[2]));

stroke = DrawingBoard.STROKES[Integer.parseInt(splits[3])];

startX = Float.parseFloat(splits[4]);

startY = Float.parseFloat(splits[5]);

endX = Float.parseFloat(splits[6]);

endY = Float.parseFloat(splits[7]);

text = new String(splits[8]);

f = new Font(splits[9], Integer.parseInt(splits[10]), Integer.parseInt(splits[11]));

at = new AffineTransform(Double.parseDouble(splits[12]),Double.parseDouble(splits[15]),Double.parseDouble(splits[14]),

Double.parseDouble(splits[13]),Double.parseDouble(splits[16]),Double.parseDouble(splits[17]));
}
}
...全文
212 25 打赏 收藏 转发到动态 举报
写回复
用AI写文章
25 条回复
切换为时间正序
请发表友善的回复…
发表回复
whcsdtc 2010-09-03
  • 打赏
  • 举报
回复
.....我不知道该说什么
依风听雨 2010-09-03
  • 打赏
  • 举报
回复
楼主这样的行为比较懒啊
closewbq 2010-09-03
  • 打赏
  • 举报
回复
哪不懂就去查API!

king138888 2010-09-03
  • 打赏
  • 举报
回复
给一大串代码,谁有空看啊!!!!!
说明白问题就好啦
Dock 2010-09-03
  • 打赏
  • 举报
回复
唉,竟然有人比我还懒,嘿嘿嘿嘿~~~~
steely_chen 2010-09-03
  • 打赏
  • 举报
回复
楼主淫才阿
hepeng_8 2010-09-03
  • 打赏
  • 举报
回复
代码 ??????
dr_lou 2010-09-03
  • 打赏
  • 举报
回复
任务紧急还。。。。
wyang1991 2010-09-03
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 wumian9063 的回复:]

自己写的代码,让人家给你加注释。你也算是个人才。
[/Quote]
+1
liuyuhua0066 2010-09-03
  • 打赏
  • 举报
回复
你这分确实不想要
coooliang 2010-09-03
  • 打赏
  • 举报
回复
[Quote=引用 13 楼 a198905011 的回复:]
没有人想拿分吗?
[/Quote]
lq860813 2010-09-03
  • 打赏
  • 举报
回复
人材啊........
zhanggc1001 2010-09-03
  • 打赏
  • 举报
回复
没有钱是万万不能的,但是有钱也不是万能的
yearnqiao 2010-09-03
  • 打赏
  • 举报
回复
楼主,你很有才,也很悲剧……
ycyyww 2010-09-03
  • 打赏
  • 举报
回复
[Quote=引用 11 楼 fatlism 的回复:]

引用 10 楼 zx343554806 的回复:
.....第一次见到这样的= =

以后还可以考虑开个公司..专门负责为各杂乱的代码添加注释....

这个想法不错!~
[/Quote]
同上
A198905011 2010-09-03
  • 打赏
  • 举报
回复
没有人想拿分吗?
yn00 2010-09-03
  • 打赏
  • 举报
回复

lz很nb啊、、
fatlism 2010-09-03
  • 打赏
  • 举报
回复
[Quote=引用 10 楼 zx343554806 的回复:]
.....第一次见到这样的= =

以后还可以考虑开个公司..专门负责为各杂乱的代码添加注释....
[/Quote]
这个想法不错!~
zx343554806 2010-09-03
  • 打赏
  • 举报
回复
.....第一次见到这样的= =

以后还可以考虑开个公司..专门负责为各杂乱的代码添加注释....
A198905011 2010-09-03
  • 打赏
  • 举报
回复
有没有人?
加载更多回复(4)

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧