Java画图板程序设计报告
绘图JAVA程序报告(含程序)

本次编程工具为 UltraEdit。
3 系统流程
开始
曲线 按钮
直线 按钮
画圆 按钮
矩形 按钮
粗线 按钮
填充 颜色
清除
画笔 粗细
f=1
f=2
f=3
f=4
f=5
填充
Y
N
fill=true
fill=false
size 改变
改变颜色
Y
N
输入颜 色
f=1
f=2
f=3
通过 JCheckBox 创建一个按钮,利用按钮监听器决定是否要描绘填 充图形,如果是则将实现赋值 fill=true,否则 fill=false,然后通过 布尔值判断在描绘图形时是 draw 还是 fill,如果布尔值是 ture 时则实 现了图形的填充。 2.2.4 画笔的粗细及画笔的颜色变更
画笔的粗细主要是通过不断地重画填充圆来实现,通过鼠标的拖拽 不断地在画板上进行重画;而粗细则由创建的 JSlider 来调节圆的半径, 如果圆的半径越大则所绘出的曲线越粗,反则越细;画笔的颜色变更主 要通过创建的 JButton 按钮,利用按钮监听器,当按下了按钮,则实现 c=JColorChooser.showDialog(right,"choose",c)语句,从而把初始的 画笔颜色(黑色)改变。 2.2.5 实现鼠标单击和鼠标拖拽进行绘图
在实现绘画的功能,主要通过创建 ButtonGroup 从而把所有的 JRadioButton 都添加进去,从而达到在描绘图形时多选一的选择功能; 利用按钮监听器,利用 Object source=event.getSource()语句当 source==op1 时进行曲线绘画,在实现曲线绘画的功能时,主要利用了 鼠标的点击和鼠标的拖拽,通过鼠标的点击来扑捉第一个坐标点,然后 利用鼠标的拖拽来不断变换第一个点的坐标(利用 sx=x 和 sy=y 语句), 从而将所有点都连接起来,最终实现了在画板上描绘曲线的功能;当 source==op2 时进行直线绘画,在实现直线绘画的功能时,主要利用了 鼠标的点击,鼠标的释放和鼠标的拖拽,通过鼠标的点击来扑捉直线的 第一个坐标点,然后利用鼠标的拖拽选择直线的另一个点,最终通过鼠 标的释放在画板上描绘出直线来;当 source==op3 时进行圆和椭圆绘画, 在实现圆和椭圆绘画的功能时,主要利用了鼠标的点击,鼠标的释放和 鼠标的拖拽,通过鼠标的点击来扑捉圆和椭圆的一个坐标点,然后利用 鼠标的拖拽选择圆和椭圆的大小,最终通过鼠标的释放在画板上描绘出 圆和椭圆来;当 source==op4 时进行矩形绘画,在实现矩形绘画的功能 时,主要利用了鼠标的点击,鼠标的释放和鼠标的拖拽,通过鼠标的点 击来扑捉矩形的一个坐标点,然后利用鼠标的拖拽选择矩形的大小,最 终通过鼠标的释放在画板上描绘出矩形来。 2.2.3 填充功能(其中包括圆的填充,椭圆圆的填充,矩形圆的填充)
画图板 课程设计报告

合肥学院计算机科学与技术系课程设计任务书2011~2012学年第二学期课程JA V A语言课程设计课程设计名称画图板专业班级08网络工程(1)指导教师金莹郭昌建2011年9月一、课程设计目的通过课程设计,学生在下述各方面的能力应该得到锻炼:(1)进一步巩固、加深学生所学专业课程《JAVA语言教程》的基本理论知识,理论联系实际,进一步培养学生综合分析问题,解决问题的能力。
(2)全面考核学生所掌握的基本理论知识及其实际业务能力,从而达到提高学生素质的最终目的。
(3)利用所学知识,开发小型应用系统,掌握运用JAVA语言编写调试应用系统程序,训练独立开发应用系统,进行数据处理的综合能力。
(4)掌握自顶而下的设计方法,将大问题进行模块化,领会结构化程序设计的方法。
(5)熟练掌握JA V A语言事件处理、图形界面、多媒体编程,灵活运用各种类库。
二、课程设计名称及内容课程设计名称:画图板设计内容:制作一个图形编辑系统—画图板,要求具有画笔、画各种图型,输入文字,橡皮檫等功能,具体参见附件中“画图板”。
三、任务和要求(1)能用拖橡皮檫的手法绘制各类图形(直线、椭圆、矩形、文字)(2)支持画笔颜色、文字大小设置;(3)能将画面中的所有图形存储到文件中;(4)能从文件读取图形进行增补;(5)采用对话框获取图形文件名;(6)利用鼠标选取图形,删除;四、设计方案提示可以采用橡皮筋技术来进行图形的绘制,绘制图形时鼠标的初始位置很关键,它关系到图形的初始位置,由于是在鼠标处于拖动状态下绘制图形,可以将鼠标按下时的位置设置为初始位置。
五、其它程序设计可在Eclipse、JDK1.5或JBuilder环境下实现六、参考资料[1]吕凤羽、马皓《JAVA程序设计》清华大学出版社[2] 耿祥义《JAVA课程设计》清华大学出版[3] 黄小东《Java课程设计案例精编》中国水利水电出版社[4]印旻《Java与面向对象程序设计》清华大学出版社。
Java画图软件设计报告

佛山科学技术学院《可视化编程技术》课程设计报告画图软件设计学生姓名:***学号:**********年级专业:11级教育技术学2班指导老师:***学院:教育科学学院广东★佛山提交日期:2013年6月目录1. 前言 (2)2.概要设计 (3)2.1 开发环境 (3)2.2 画图软件功能 (3)2.3 界面设计 (3)2.4 类的框架结构图 (4)3. 详细设计 (4)3.1 使用的JAVA类的说明 (4)3.2 类的主要方法 (5)3.2.1 颜色选择器 (5)3.2.2 控制画笔样式 (5)3.2.3 选取颜色按钮的监听件类 (6)3.2.4 设计总体认识 (6)3.2.5 程序流程图 (7)4. 运行结果 (7)5. 测试分析 (8)5.1 程序运行情况 (8)6. 源程序 (8)参考文献 (14)设计总结 (14)摘要:该程序是一个图形界面的简单的java画图软件,具有良好的界面,使用人员能快捷简单地进行操作。
该画图软件操作较为简单,只需要一直按着左键就能根据你鼠标移动的方面,画出你想要的图案。
你也可以选择你自己想到的颜色和画笔的粗细。
而且可以显示你当前的画笔的状态。
界面为灰白对称。
是一个非常简单的作图工具,让人能轻松上手。
关键字:java,画图类,方法,事件1 前言随着科学技术的不断发展,计算机已经成为我们工作学习和生活中不可缺少的工具。
文本编辑器是个人计算机最司空见惯的应用程序了,在学习了Java语言之后,我决定使用Java语言编写一个简单的画图工具,可以实现简单的画图作图功能,满足日常基本的工作学习和娱乐需要。
Java是由Sun公司开发的新一代纯面向对象的网络编程语言。
其目标是建立一种在任意种机器、任一种操作系统的网络环境中运行的软件,实行所谓的“程序写一次,到处运行”的目标。
正因为如此,Java已成为当今Internet上最流行、最受欢迎的一种程序开发语言。
Java开发小组把Java按特性分为基本版、移动版、企业版,每个版本有一个软件开发包。
JAVA-SWING图形界面程序设计实验报告(附完整代码)

图形界面(GUI)程序设计一、课题内容和要求内容:设计和编写一个用于将人民币转换为等值的美元的程序,界面要求可以输入人民币的金额并可以得到转换后的结果。
要求:学习和理解JAVA SWING中的容器,部件,布局管理器和部件事件处理方法。
通过编写和调试程序,掌握JAVA图形界面程序设计的基本方法。
二、设计思路分析class RMBtoDollar:主类,调用主函数。
class change:设置界面,并通过界面上的事件触发实现汇率转换。
三、概要设计public class RMBtoDollar{public static void main(String[] args);}class change extends JFrame implements MouseListener { JLabel l1, l2,l3;JTextField tf1, tf2;JButton b;double RMB, Dollar;public change();public void mousePressed(MouseEvent e);public void mouseClicked(MouseEvent e);public void mouseEntered(MouseEvent e);public void mouseExited(MouseEvent e);public void mouseReleaseed(MouseEvent e);//鼠标释放时进行转换}四、详细设计import java.awt.*;import java.awt.event.*;import javax.swing.*;public class RMBtoDollar {public static void main(String[] args) {new change();}}class change extends JFrame implements MouseListener { JLabel l1, l2,l3;JTextField tf1, tf2;JButton b;double RMB, Dollar;public change() {//添加组件和设置布局l1 = new JLabel("人民币/元:");l2 = new JLabel("美元/dollar:");l3=new JLabel("(汇率:6.17)");tf1 = new JTextField(12);tf2 = new JTextField(12);b = new JButton("转换");add(l1);add(tf1);add(l2);add(tf2);add(l3);add(b);setLayout(new FlowLayout(FlowLayout.CENTER));setTitle("人民币转换为美元");setBounds(300, 300, 300, 150);setVisible(true);setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);b.addMouseListener(this);//鼠标事件监视器}public void mousePressed(MouseEvent e) {if (tf2.getText() != null) {// tf2 test 默认初始设为空tf2.setText("");}}public void mouseClicked(MouseEvent e) {}public void mouseEntered(MouseEvent e) {}public void mouseExited(MouseEvent e) {}public void mouseReleased(MouseEvent e) {if (tf1.getText() != null) {// 检查tf1 test 是否为空try {// 取异常RMB = Double.parseDouble(tf1.getText());// 字符转为double型Dollar = RMB / 6.17;//转换tf2.setText("" + Dollar);// 显示} catch (Exception ex) {tf1.setText("");// 如果输入不是数字,设为空}}}}五、测试数据及其结果分析1正常输入:2输入字符串不能转为double型时清空输入框:3结果:输出正常。
南邮Java实验报告1-综合图形界面程序设计

南邮Java实验报告1-综合图形界面程序设计英文回答:Hello, I'm glad to help you with your Java lab report on comprehensive graphical user interface programming.In this report, I will provide a detailed description of the steps I took to create a graphical user interface (GUI) for a simple application. I will also include screenshots of the GUI and discuss the challenges I faced and how I overcame them.Step 1: Create a new Java project。
The first step was to create a new Java project in my preferred development environment. I used IntelliJ IDEA, but you can use any IDE that you are comfortable with.Step 2: Design the GUI。
Once I had created a new project, I began designing the GUI. I sketched out a rough draft on paper and then usedthe Swing library to create the actual GUI.The Swing library provides a set of components that can be used to create GUIs. These components include buttons, text fields, labels, and menus.Step 3: Add functionality to the GUI。
南邮Java实验报告1-综合图形界面程序设计

南邮Java实验报告1-综合图形界面程序设计英文回答:This report presents the findings of a comprehensive study on the design and implementation of a graphical user interface (GUI) program using Java. The experiment involved the development of a simple calculator application with basic arithmetic functions. The GUI was designed using the Java Swing library, which provided a wide range of pre-built components for creating user interfaces.The development process began with a thorough analysis of the user requirements for the calculator application. Based on this analysis, a user interface prototype was created using a wireframing tool. This prototype served as the blueprint for the final GUI design.The next step was to implement the GUI using Java Swing components. These components include buttons, text fields,labels, and panels, which were arranged and configured to create a user-friendly and intuitive interface. The calculator's basic arithmetic operations were implemented using simple mathematical expressions and conditional statements.Throughout the development process, extensive testing was conducted to ensure the functionality and reliability of the GUI program. Unit tests were used to verify the behavior of individual components, while integration tests ensured that the components worked together seamlessly. Performance tests were also conducted to assess the responsiveness of the GUI under various loads.The final GUI program was a fully functional calculator with a user-friendly interface and reliable performance. It demonstrated the effectiveness of Java Swing for creating complex GUI applications with ease and efficiency.中文回答:南邮Java实验报告1-综合图形界面程序设计。
我的java课程设计报告之画图板

我的java课程设计报告画图板目录1.项目背景/12.功能图/13.类图/14.源代码/15.运行结果/121.项目背景本设计的目的是综合面向对象程序设计课程中所学到的知识来开发一个小型的Java应用程序—画图板。
本项目的开发工具是Eclipse 4.5。
2.功能图3.类图4.源代码import java.applet.Applet;import java.awt.*;import java.awt.Point;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.ItemEvent;import java.awt.event.ItemListener;import java.awt.event.MouseAdapter;import java.awt.event.MouseEvent;import java.awt.event.MouseMotionAdapter;import java.awt.event.WindowAdapter;2import java.awt.event.WindowEvent;import java.awt.geom.Ellipse2D;import java.awt.geom.Line2D;import java.awt.geom.Rectangle2D;import java.awt.image.BufferedImage;import java.io.File;import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.io.IOException;import java.io.ObjectInputStream;import java.io.ObjectOutputStream;import java.io.Serializable;import java.util.Properties;import java.util.Vector;import javax.imageio.ImageIO;import javax.swing.JColorChooser;import javax.swing.JFileChooser;import javax.swing.JOptionPane;import com.sun.image.codec.jpeg.JPEGCodec;import com.sun.image.codec.jpeg.JPEGEncodeParam;import com.sun.image.codec.jpeg.JPEGImageEncoder;public class DrawPencil extends Applet{private static final long serialVersionUID = 1L;Vector paintInfo = null;// 点信息向量组int n = 1;MediaTracker mt;int x = -1, y = -1;int con = 1;int Econ = 5;int toolFlag = 0;Color c = new Color(0, 0, 0);BasicStroke size = new BasicStroke(con, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL);EveryPoint cutflag = new EveryPoint(-1, -1, c, 6, con);Panel toolPanel;Button eraser, drLine, drCircle, drRect;Button clear, pen;Choice ColChoice, SizeChoice, EraserChoice;Button colchooser;3Label 颜色, 大小B, 大小E;Button openPic, savePic;FileDialog openPicture, savePicture;public DrawPencil(){super();}public void init(){this.setSize(900, 600);paintInfo = new Vector();ColChoice = new Choice();ColChoice.add("black");ColChoice.add("red");ColChoice.add("blue");ColChoice.add("green");ColChoice.addItemListener(new ItemListener(){public void itemStateChanged(ItemEvent e){String name = ColChoice.getSelectedItem();if (name == "black"){c = new Color(0, 0, 0);}else if (name == "red"){c = new Color(255, 0, 0);}else if (name == "green"){c = new Color(0, 255, 0);}else if (name == "blue"){c = new Color(0, 0, 255);}}});SizeChoice = new Choice();SizeChoice.add("1");4SizeChoice.add("3");SizeChoice.add("5");SizeChoice.add("7");SizeChoice.add("9");SizeChoice.addItemListener(new ItemListener(){public void itemStateChanged(ItemEvent e){String selected = SizeChoice.getSelectedItem();if (selected == "1"){con = 1;size = new BasicStroke(con, BasicStroke.CAP_BUTT,BasicStroke.JOIN_BEVEL);}else if (selected == "3"){con = 3;size = new BasicStroke(con, BasicStroke.CAP_BUTT,BasicStroke.JOIN_BEVEL);}else if (selected == "5"){con = 5;size = new BasicStroke(con, BasicStroke.CAP_BUTT,BasicStroke.JOIN_BEVEL);}else if (selected == "7"){con = 7;size = new BasicStroke(con, BasicStroke.CAP_BUTT,BasicStroke.JOIN_BEVEL);}else if (selected == "9"){con = 9;size = new BasicStroke(con, BasicStroke.CAP_BUTT,BasicStroke.JOIN_BEVEL);}}});EraserChoice = new Choice();EraserChoice.add("5");EraserChoice.add("9");5EraserChoice.add("13");EraserChoice.add("17");EraserChoice.addItemListener(new ItemListener(){public void itemStateChanged(ItemEvent e){String Esize = EraserChoice.getSelectedItem();if (Esize == "5"){Econ = 5 * 2;}else if (Esize == "9"){Econ = 9 * 2;}else if (Esize == "13"){Econ = 13 * 2;}else if (Esize == "17"){Econ = 17 * 3;}}});toolPanel = new Panel();clear = new Button("清除");eraser = new Button("橡皮");pen = new Button("画笔");drLine = new Button("画直线");drCircle = new Button("画圆形");drRect = new Button("画矩形");openPic = new Button("打开图画");savePic = new Button("保存图画");clear.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){toolFlag = 2;paintInfo.removeAllElements();repaint();}});6eraser.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){// TODO自动生成方法存根toolFlag = 1;}});pen.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){// TODO自动生成方法存根toolFlag = 0;}});drLine.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){toolFlag = 3;}});drCircle.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){toolFlag = 4;}});drRect.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){toolFlag = 5;}});savePic.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){printPanelToJPG(toolPanel);}});7颜色 = new Label("画笔颜色", Label.CENTER);大小B = new Label("画笔大小", Label.CENTER);大小E = new Label("橡皮大小", Label.CENTER);toolPanel.add(savePic);toolPanel.add(pen);toolPanel.add(drLine);toolPanel.add(颜色);toolPanel.add(ColChoice);toolPanel.add(大小B);toolPanel.add(SizeChoice);toolPanel.add(eraser);toolPanel.add(大小E);toolPanel.add(EraserChoice);toolPanel.add(clear);this.add(toolPanel);setBounds(60, 60, 900, 600);setVisible(true);validate();this.addMouseMotionListener(new MouseMotionAdapter(){public void mouseDragged(MouseEvent e){EveryPoint p1;switch (toolFlag){case 0:x = (int) e.getX();y = (int) e.getY();p1 = new EveryPoint(x, y, c, toolFlag, con);paintInfo.addElement(p1);repaint();break;case 1:x = (int) e.getX();y = (int) e.getY();p1 = new EveryPoint(x, y, null, toolFlag, Econ);paintInfo.addElement(p1);repaint();break;default:}}});8this.addMouseListener(new MouseAdapter(){public void mousePressed(MouseEvent e){EveryPoint p2;switch (toolFlag){case 3:x = (int) e.getX();y = (int) e.getY();p2 = new EveryPoint(x, y, c, toolFlag, con);paintInfo.addElement(p2);break;case 4:x = (int) e.getX();y = (int) e.getY();p2 = new EveryPoint(x, y, c, toolFlag, con);paintInfo.addElement(p2);break;case 5:x = (int) e.getX();y = (int) e.getY();p2 = new EveryPoint(x, y, c, toolFlag, con);paintInfo.addElement(p2);break;default:}}public void mouseReleased(MouseEvent e){EveryPoint p3;switch (toolFlag){case 0:paintInfo.addElement(cutflag);break;case 1:paintInfo.addElement(cutflag);break;case 3:x = (int) e.getX();y = (int) e.getY();p3 = new EveryPoint(x, y, c, toolFlag, con);9paintInfo.addElement(p3);paintInfo.addElement(cutflag);repaint();break;case 4:x = (int) e.getX();y = (int) e.getY();p3 = new EveryPoint(x, y, c, toolFlag, con);paintInfo.addElement(p3);paintInfo.addElement(cutflag);repaint();break;case 5:x = (int) e.getX();y = (int) e.getY();p3 = new EveryPoint(x, y, c, toolFlag, con);paintInfo.addElement(p3);paintInfo.addElement(cutflag);repaint();break;default:}}});}public void paint(Graphics g){Graphics2D g2d = (Graphics2D) g;EveryPoint p1, p2;n = paintInfo.size();if (toolFlag == 2)g.clearRect(0, 0, getSize().width, getSize().height);// 清除for (int i = 0; i < n - 1; i++){p1 = (EveryPoint) paintInfo.elementAt(i);p2 = (EveryPoint) paintInfo.elementAt(i + 1);size = new BasicStroke(p1.boarder, BasicStroke.CAP_BUTT,BasicStroke.JOIN_BEVEL);g2d.setColor(p1.col);g2d.setStroke(size);if (p1.tool == p2.tool){switch (p1.tool)10{case 0:Line2D line1 = new Line2D.Double(p1.x, p1.y, p2.x,p2.y);g2d.draw(line1);break;case 1:g.clearRect(p1.x, p1.y, p1.boarder, p1.boarder);break;case 3:Line2D line2 = new Line2D.Double(p1.x, p1.y, p2.x,p2.y);g2d.draw(line2);break;case 4:Ellipse2D ellipse = new Ellipse2D.Double(p1.x, p1.y, Math.abs(p2.x - p1.x), Math.abs(p2.y - p1.y));g2d.draw(ellipse);break;case 5:Rectangle2D rect = new Rectangle2D.Double(p1.x, p1.y, Math.abs(p2.x - p1.x), Math.abs(p2.y - p1.y));g2d.draw(rect);break;case 6:i = i + 1;break;default:}}}}public void update(Graphics g){paint(g);}public void printPanelToJPG(Panel graph){int width = this.getWidth();int height = this.getHeight();BufferedImage bi = new BufferedImage(width, height,BufferedImage.TYPE_3BYTE_BGR);Graphics2D g2d = (Graphics2D) bi.createGraphics();g2d = (Graphics2D) bi.getGraphics();try{JFileChooser chooser = new JFileChooser(".//");chooser.setAcceptAllFileFilterUsed(false);chooser.setSelectedFile(new File("1.jpg"));int status = chooser.showSaveDialog(graph);if (status == JFileChooser.APPROVE_OPTION){File saveFile = chooser.getSelectedFile();if (saveFile.exists()){String prompt = "The file "+ saveFile.getName()+ " already exists. Do you want to replace the existing file";int ret = JOptionPane.showConfirmDialog(graph, prompt,"Warning", JOptionPane.YES_NO_OPTION);if (ret == JOptionPane.NO_OPTION){return;}}saveFile = new File(saveFile.getAbsoluteFile() + ".jpg");FileOutputStream fos = new FileOutputStream(saveFile);JPEGImageEncoder jpegEncoder =JPEGCodec.createJPEGEncoder(fos);jpegEncoder.encode(bi);fos.flush();fos.close();}}catch (IOException ex){JOptionPane.showMessageDialog(graph, "IO Error, operation failed\n"+ ex.toString(), "Error", JOptionPane.PLAIN_MESSAGE);}}private Point Point(int i, int j){Point point = new Point(i, j);return point;}}class EveryPoint implements Serializable{int x, y;Color col;int tool;int boarder;private static final long serialVersionUID = 1L;EveryPoint(int x, int y, Color col, int tool, int boarder) {this.x = x;this.y = y;this.col = col;this.tool = tool;this.boarder = boarder;}}5.运行结果。
JAVA课程设计(画图板软件开发和设计)

功能测试:确保所有功能正常工作 性能测试:评估系统性能,如响应时间、吞吐量等 兼容性测试:确保在不同操作系统和浏览器上正常运行 用户体验测试:评估用户界面设计、易用性等
硬件要求:CPU、内存、硬盘等 软件要求:JDK、Tomcat、数据库等 部署步骤:安装JDK、Tomcat、数据库等,配置环境变量,部署项目 运行步骤:启动Tomcat,访问项目地址,进行测试和调试
优化网络 传输:减 少网络延 迟,提高 数据传输 速度
优化数据 库访问: 减少数据 库查询次 数,提高 查询效率
优化系统 日志:减 少日志记 录,提高 系统运行 效率
优化系统 安全:加 强系统安 全防护, 提高系统 安全性能
项目成果:成功开发出画图板 软件,实现了基本的绘图功能
项目目标:开发一个画图板 软件,实现基本的绘图功能
数据库索引:用户ID、画图板ID等
数据库备份和恢复策略:定期备份,异地 存储,灾难恢复等
数据库安全:用户权限管理,数据加密, 访问控制等
画笔算法:实现画笔的绘制和移动
图形选择算法:实现图形的选择和绘制
橡皮擦算法:实现橡皮擦的擦除功能
颜色选择算法:实现颜色的选择和切换
撤销和重做算法:实现撤销和重做操作
项目经验:在开发过程中,学 习了JAVA编程、图形绘制、用
户界面设计等知识
项目展望:未来可以继续优化 画图板软件,增加更多功能,
提高用户体验
功能实现:部分功 能实现不够完善, 需要进一步优化
用户体验:界面 设计不够友好, 需要改进
性能优化:程序 运行速度较慢, 需要优化
团队协作:团队成 员之间沟通不够顺 畅,需要加强团队 协作能力
画图板功 能:支持 绘制各种 图形,如 直线、曲 线、矩形、 圆形等
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
西安科技大学Java语言课程设计报告¥题目:画图板应用程序开发&班级:学号:姓名:2010年 12 月目录1 设计题目及具体要求 (3)·2 总体设计 (6)3 详细设计与实现 (4)4 系统测试 (11)5 设计小结 (31)参考文献$:1、设计题目及具体要求题目需求?1. 设计题目:小画图板的开发。
2. 重点分析本软件的重难点为主窗体的设计、菜单栏和工具栏的设计、事件响应的处理、画图的基本功能的实现。
3. 实现功能1.新建一个空白图形文件:用于绘制新的图形。
2.打开或保存一个图形文件,便于对图形文件的管理。
3.绘制一些基本的图形组件:直线,矩形,实心矩形,椭圆,实心椭圆,圆,实心圆,圆角矩形,实心圆角矩形等。
4.用鼠标在绘图板上单击拖动进行随笔花。
5.`6.橡皮擦:可以将已绘制的图形擦掉。
7.添加文字:可以在绘图区域内添加文字。
8.选择文字的字体:通过一个下拉式的选择条,可以选中所需要的字体。
本程序中包括:宋体,隶书,华文彩云,仿宋-GB2312,华文行楷,Times New Roman,Serif,Monospaced,SonsSerif,Garamond。
当然,在下面的程序分析中可以看到,由于设置了字体选择数组,使得可以随意添加系统支持的任何字体。
大大方便和简化了程序设计。
9.选择文字的字体风格:通过两个复选框按钮,可以选择需要的字体风格,包括:粗体,斜体,用同时选中两者,只选择其中一种或两者都不选中3种选择方式。
10.设置画笔的颜色:可以选择当前绘制图形的画笔颜色,让图形更加丰富多彩,生动活泼。
10. 设置画笔的粗细:该选项在作用于基本图形组件和文字时,它的效果是不同的。
当作用于绘制图形组建时,它的作用是改变画笔绘制线条的粗细;当作用于文字时,它的作用是改变文字的大小。
;4. 功能图图1-1 画图板应用程序功能结构图1.2实现环境及工具简介CPU:Intel Core(TM)2 E5300 内存:2G运行平台:Windows XP 主频:开发平台:Eclipse 主板:ASUSTeK Computer INC. P5QL-ASUS-SE ;Eclipse简介:Eclipse——IBM的Java IDE开发环境IBM-Eclipse简介:Eclipse 是一个开放源代码的、基于 Java 的可扩展开发平台。
就其本身而言,它只是一个框架和一组服务,用于通过插件组件构建开发环境。
幸运的是,Eclipse 附带了一个标准的插件集,包括 Java 开发工具(Java Development Tools,JDT)。
IBM-Eclipse版本历史:Eclipse最初是由IBM公司开发的替代商业软件Visual Age for Java的下一代IDE开发环境,2001年11月贡献给开源社区,现在它由非营利软件供应商联盟Eclipse基金会(Eclipse Foundation)管理。
2003年,Eclipse 选择OSGi服务平台规范为运行时架构。
2007年6月,稳定版发布。
2008年6月发布代号为Ganymede的版。
2009年7月发布代号为GALILEO的版。
2010年6月发布代号为Helios的版。
IBM-Eclips语言拓展:Eclipse是著名的跨平台的自由集成开发环境(IDE)。
最初主要用来Java语言开发,但是目前亦有人通过插件使其作为其他计算机语言比如C++和Python的开发工具。
Eclipse 的本身只是一个框架平台,但是众多插件的支持使得Eclipse拥有其他功能相对固定的IDE 软件很难具有的灵活性。
许多软件开发商以Eclipse为框架开发自己的IDE。
[Eclipse 最初由OTI和IBM两家公司的IDE产品开发组创建,起始于1999年4月。
IBM 提供了最初的Eclipse代码基础,包括Platform、JDT 和PDE。
目前由IBM牵头,围绕着Eclipse项目已经发展成为了一个庞大的Eclipse联盟,有150多家软件公司参与到Eclipse 项目中,其中包括Borland、Rational Software、Red Hat及Sybase等。
Eclipse是一个开发源码项目,它其实是 Visual Age for Java的替代品,其界面跟先前的Visual Age for Java差不多,但由于其开放源码,任何人都可以免费得到,并可以在此基础上开发各自的插件,因此越来越受人们关注。
近期还有包括Oracle在内的许多大公司也纷纷加入了该项目,并宣称Eclipse将来能成为可进行任何语言开发的IDE集大成者,使用者只需下载各种语言的插件即可。
Eclipse 插件开发环境虽然大多数用户很乐于将 Eclipse 当作 Java IDE 来使用,但 Eclipse 的目标不仅限于此。
Eclipse 还包括插件开发环境(Plug-in Development Environment,PDE),这个组件主要针对希望扩展 Eclipse 的软件开发人员,因为它允许他们构建与 Eclipse 环境无缝集成的工具。
由于 Eclipse 中的每样东西都是插件,对于给 Eclipse 提供插件,以及给用户提供一致和统一的集成开发环境而言,所有工具开发人员都具有同等的发挥场所。
基于 Eclipse 的应用程序的突出例子是 IBM 的 WebSphere Studio Workbench,它构成了 IBM Java 开发工具系列的基础。
例如,WebSphere Studio Application Developer 添加了对 JSP、servlet、EJB、XML、Web 服务和数据库访问的支持。
Eclipse的主要组成Eclipse是一个开放源代码的软件开发项目,专注于为高度集成的工具开发提供一个全功能的、具有商业品质的工业平台。
它主要由Eclipse项目、Eclipse工具项目和Eclipse技术项目三个项目组成,具体包括四个部分组成——Eclipse Platform、JDT、CDT和PDE。
JDT支持Java开发、CDT支持C开发、PDE用来支持插件开发,Eclipse Platform则是一个开放的可扩展IDE,提供了一个通用的开发平台。
它提供建造块和构造并运行集成软件开发工具的基础。
Eclipse Platform允许工具建造者独立开发与他人工具无缝集成的工具从而无须分辨一个工具功能在哪里结束,而另一个工具功能在哪里开始。
Eclipse SDKEclipse SDK(软件开发者包)是Eclipse Platform、JDT和PDE所生产的组件合并,它们可以一次下载。
这些部分在一起提供了一个具有丰富特性的开发环境,允许开发者有效地建造可以无缝集成到Eclipse Platform中的工具。
Eclipse SDK由Eclipse项目生产的工具和来自其它开放源代码的第三方软件组合而成。
Eclipse项目生产的软件以 GPL发布,第三方组件有各自自身的许可协议。
、2、总体设计基本图形按钮基本图形按钮包括:Pencil(随笔画)、Line(直线)、Rect(矩形)、fRect(实心矩形)、Oval(椭圆)、fOval(实心椭圆)、Circle(圆)、fCircle(实心圆)、RoundRect(圆角矩形)、frrect(实心圆角矩形)、Rubber(橡皮擦)、Word(字)。
基本图形都继承自同一个父类:drawings。
Drawings具有的变量(属性):int x1, y1, x2, y2;主界面框架主界面类继承自JFrame类,包括构造函数及各种功能的定义,主要代码如下:—import .*;import .*;import .*;import .*;public class MiniDrawPad extends JFrame 新建、保存、打开、退出菜单项代码如下:线条宽度、颜色、提示功能!代码如下:工具栏图形按钮功能实现创建基本图形按钮、导入图标、加入动作侦听器、字体风格选择、字体选择、画图板等功能的实现。
代码如下:pg");choices[i]=new JButton("",items[i]);choices[i].setToolTipText(tipText[i]);(choices[i]);。
}ddActionListener(handler);}choices[0].addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e)。
{newFile();}});choices[1].addActionListener(new ActionListener(){】public void actionPerformed(ActionEvent e) {loadFile();}});choices[2].addActionListener(【new ActionListener(){public void actionPerformed(ActionEvent e) {saveFile();}});choices[].addActionListener(handler1);·choices[].addActionListener(handler1);choices[].addActionListener(handler1);1=itemList[index].x2=();itemList[index].y1=itemList[index].y2=();1=itemList[index].x2=();itemList[index].y1=itemList[index].y2=();)index++;createNewItem();}1=();itemList[index].y1=();String input;¥input=("Please input the text you want!"); itemList[index].s1=input;itemList[index].x2=f1;itemList[index].y2=f2;itemList[index].s2=style1;index++;]currentChoice=14;createNewItem();();}}public void mouseReleased(MouseEvent e){(" Mouse Released @:[" + () +}", " + () + "]");if(currentChoice==3||currentChoice==13){itemList[index].x1=();itemList[index].y1=();}itemList[index].x2=();《itemList[index].y2=();repaint();index++;createNewItem();}public void mouseEntered(MouseEvent e){(" Mouse Entered @:[" + () +.", " + () + "]"); }public void mouseExited(MouseEvent e){(" Mouse Exited @:[" + () +", " + () + "]"); }\}class mouseB extends MouseMotionAdapter{public void mouseDragged(MouseEvent e){(" Mouse Dragged @:[" + () +", " + () + "]");if(currentChoice==3||currentChoice==13){itemList[index-1].x1=itemList[index].x2=itemList[index].x1=();…itemList[index-1].y1=itemList[index].y2=itemList[index].y1=(); index++;createNewItem();}else{itemList[index].x2=();itemList[index].y2=();#}repaint();}public void mouseMoved(MouseEvent e){(" Mouse Moved @:[" + () +", " + () + "]");}}}ype=currentChoice;itemList[index].R=R;itemList[index].G=G;itemList[index].B=B;itemList[index].stroke=stroke;}=R;'itemList[index].G=G;itemList[index].B=B;}troke=stroke;}quals(""))'(fileChooser,"Invalid File Name","Invalid File Name", ;else{try {();FileOutputStream fos=new FileOutputStream(fileName); output=new ObjectOutputStream(fos);】drawings record;( index );for(int i=0;i< index ;i++){drawings p= itemList[ i ] ;(p);.(); quals(""))(fileChooser,"Invalid File Name","Invalid File Name", ;else {try {FileInputStream fis=new FileInputStream(fileName);:input=new ObjectInputStream(fis);drawings inputRecord;int countNumber=0;countNumber=();for(index=0;index< countNumber ;index++){(inputRecord=(drawings)();itemList[ index ] = inputRecord ;}createNewItem();();repaint();}$catch(EOFException endofFileException){(this,"no more record in file","class not found", );}catch(ClassNotFoundException classNotFoundException){ (this,"Unable to Create Object","end of file", );}catch (IOException ioException){(this,"error during read from file","read Error", );}}}各种画图功能的实现代码如下:各功能运行结果打开、保存、设置线宽、颜色设置功能图分别见3-1, 3-2,3-3, 3-4,这里不再赘述。