• 大小: 8.95MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-12
  • 语言: Java
  • 标签: 其他  

资源简介

Java课程设计案例精编源代码(3).rar

资源截图

代码片段和文件信息

package drawingpanel;

import java.awt.*;
import java.awt.geom.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.util.*;


public class MiniDrawPad extends Jframe     //主类,扩展了Jframe类,用来生成主界面
 {
  private objectInputStream  input;
  private objectOutputStream output; //定义输入输出流,用来调用和保存图像文件

  private JButton choices[];         //按钮数组,存放以下名称的功能按钮

  private String names[]={
          “New“
          “Open“
          “Save“    //这三个是基本操作按钮,包括“新建“、“打开“、“保存“

        /*接下来是我们的画图板上面有的基本的几个绘图单元按钮*/

          “Pencil“ //铅笔画,也就是用鼠标拖动着随意绘图
          “Line“ //绘制直线
          “Rect“ //绘制空心矩形
          “fRect“ //绘制以指定颜色填充的实心矩形
          “Oval“ //绘制空心椭圆
          “fOval“ //绘制以指定颜色填充的实心椭圆
          “Circle“ //绘制圆形
          “fCircle“ //绘制以指定颜色填充的实心圆形
          “RoundRect“ //绘制空心圆角矩形
          “frRect“ //绘制以指定颜色填充的实心圆角矩形
          “Rubber“ //橡皮擦,可用来擦去已经绘制好的图案
          “Color“ //选择颜色按钮,可用来选择需要的颜色
          “Stroke“ //选择线条粗细的按钮,输入需要的数值可以实现绘图线条粗细的变化
          “Word“ //输入文字按钮,可以在绘图板上实现文字输入
          };

  private String styleNames[]={
            “ 宋体 “  “ 隶书 “  “ 华文彩云 “  “ 仿宋_GB2312 “  “ 华文行楷 “ 
            “ 方正舒体 “  “ Times New Roman “  “ Serif “  “ Monospaced “ 
            “ SonsSerif “  “ Garamond “
            };            //可供选择的字体项
                          //当然这里的灵活的结构可以让读者自己随意添加系统支持的字体

  private Icon items[];

  private String tipText[]={
                  //这里是鼠标移动到相应按钮上面上停留时给出的提示说明条
                  //读者可以参照上面的按钮定义对照着理解
                “Draw a new picture“
                “Open a saved picture“
                “Save current drawing“
                “Draw at will“
                “Draw a straight line“
                “Draw a rectangle“
                “Fill a ractangle“
                “Draw an oval“
                “Fill an oval“
                “Draw a circle“
                “Fill a circle“
                “Draw a round rectangle“
                “Fill a round rectangle“
                “Erase at will“
                “Choose current drawing color“
                “Set current drawing stroke“
                “Write down what u want“
              };

  JToolBar buttonPanel ;        //定义按钮面板
  private JLabel statusBar;            //显示鼠标状态的提示条

  private DrawPanel drawingArea;       //画图区域
  private int width=800height=550;    //定义画图区域初始大小

  drawings[] itemList=new drawings[5000]; //用来存放基本图形的数组
  private int currentChoice=3;            //设置默认画图状态为随笔画
  int index=0;                         //当前已经绘制的图形数目
  private Color color=Color.black;     //当前画笔颜色
  int RGB;                           //用来存放当前色彩值

  int f1f2;                  //用来存放当前字体风格
  String style1;              //用来存放当前字体
  private float stroke=1.0f;  //设置画笔粗细,默认值为1.0f

  JCheckBox bolditalic;      //定义字体风格选择框
                              //bold为粗体,italic为斜体,二者可以同时使用
  JComboBox styles;

  public MiniDrawPad()        //构造函数
  {
   super(“Drawing Pad“);
   JMenuBar bar=new JMenuBar(); //定义菜单条
   JMenu 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件    2467305  2002-03-20 14:30  JSP核心技术和电子商务应用实例源代码分析\1.PDF

     文件    3598793  2002-03-20 14:32  JSP核心技术和电子商务应用实例源代码分析\2.PDF

     文件    1094804  2002-03-20 14:32  JSP核心技术和电子商务应用实例源代码分析\3.pdf

     文件    1508681  2002-03-20 14:33  JSP核心技术和电子商务应用实例源代码分析\4.pdf

     文件     305246  2002-03-20 14:33  JSP核心技术和电子商务应用实例源代码分析\5.pdf

     文件     379315  2002-03-20 14:33  JSP核心技术和电子商务应用实例源代码分析\6.pdf

     目录          0  2007-11-01 21:47  JSP核心技术和电子商务应用实例源代码分析

     文件       2569  2004-04-27 13:46  DrawingPanel\DrawingPANel.jpx

     文件       1942  2004-04-27 13:46  DrawingPanel\DrawingPANel.jpx.local

     文件       1497  2004-04-27 13:46  DrawingPanel\DrawingPANel.jpx.local~

     文件          0  2004-04-27 13:46  DrawingPanel\DrawingPANel.jpx~

     文件      23730  2004-04-27 13:46  DrawingPanel\bak\drawingpanel\MiniDrawPad.java~1~

     文件      23731  2004-04-27 13:46  DrawingPanel\bak\drawingpanel\MiniDrawPad.java~2~

     目录          0  2007-11-01 21:48  DrawingPanel\bak\drawingpanel

     目录          0  2007-11-01 21:48  DrawingPanel\bak

     文件       1022  2004-04-27 13:46  DrawingPanel\classes\drawingpanel\Circle.class

     文件        616  2004-04-27 13:46  DrawingPanel\classes\drawingpanel\drawings.class

     文件       1030  2004-04-27 13:46  DrawingPanel\classes\drawingpanel\fillCircle.class

     文件        960  2004-04-27 13:46  DrawingPanel\classes\drawingpanel\fillOval.class

     文件        960  2004-04-27 13:46  DrawingPanel\classes\drawingpanel\fillRect.class

     文件        981  2004-04-27 13:46  DrawingPanel\classes\drawingpanel\fillRoundRect.class

     文件        839  2004-04-27 13:46  DrawingPanel\classes\drawingpanel\Line.class

     文件        699  2004-04-27 13:46  DrawingPanel\classes\drawingpanel\MiniDrawPad$1.class

     文件        702  2004-04-27 13:46  DrawingPanel\classes\drawingpanel\MiniDrawPad$10.class

     文件        914  2004-04-27 13:46  DrawingPanel\classes\drawingpanel\MiniDrawPad$11.class

     文件        542  2004-04-27 13:46  DrawingPanel\classes\drawingpanel\MiniDrawPad$12.class

     文件        700  2004-04-27 13:46  DrawingPanel\classes\drawingpanel\MiniDrawPad$2.class

     文件        700  2004-04-27 13:46  DrawingPanel\classes\drawingpanel\MiniDrawPad$3.class

     文件        692  2004-04-27 13:46  DrawingPanel\classes\drawingpanel\MiniDrawPad$4.class

     文件        703  2004-04-27 13:46  DrawingPanel\classes\drawingpanel\MiniDrawPad$5.class

............此处省略30个文件信息

评论

共有 条评论