• 大小: 51KB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-06-17
  • 语言: Java
  • 标签:

资源简介

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

资源截图

代码片段和文件信息

package drawingpanel;
//download by http://www.codesc.net
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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

     文件        701  2004-04-27 13:46  codesc.net\DrawingPanel\classes\drawingpanel\MiniDrawPad$6.class

     文件        875  2004-04-27 13:46  codesc.net\DrawingPanel\classes\drawingpanel\MiniDrawPad$7.class

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

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

     文件       1063  2004-04-27 13:46  codesc.net\DrawingPanel\classes\drawingpanel\MiniDrawPad$ButtonHandler.class

     文件       1375  2004-04-27 13:46  codesc.net\DrawingPanel\classes\drawingpanel\MiniDrawPad$ButtonHandler1.class

     文件       1271  2004-04-27 13:46  codesc.net\DrawingPanel\classes\drawingpanel\MiniDrawPad$checkBoxHandler.class

     文件       1662  2004-04-27 13:46  codesc.net\DrawingPanel\classes\drawingpanel\MiniDrawPad$DrawPanel.class

     文件       3005  2004-04-27 13:46  codesc.net\DrawingPanel\classes\drawingpanel\MiniDrawPad$mouseA.class

     文件       1821  2004-04-27 13:46  codesc.net\DrawingPanel\classes\drawingpanel\MiniDrawPad$mouseB.class

     文件      12944  2004-04-27 13:46  codesc.net\DrawingPanel\classes\drawingpanel\MiniDrawPad.class

     文件        952  2004-04-27 13:46  codesc.net\DrawingPanel\classes\drawingpanel\Oval.class

     文件        843  2004-04-27 13:46  codesc.net\DrawingPanel\classes\drawingpanel\Pencil.class

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

评论

共有 条评论

相关资源