JAVA做的画图软件

  • Z6_196894
    了解作者
  • 8.2KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-06-07 23:00
    上传日期
做课程设计时用来的,现在放上来,看有没有人需要的,呵呵
JAVA做的画图软件.rar
  • 改进后
  • GraphProg.java
    1.3KB
  • ScaleImageDemo.java
    7.1KB
  • JPGFilter.java
    759B
  • PanelPic.java
    7.1KB
  • GraFrame.java
    14.2KB
内容介绍
package grapro; import java.awt.*; import java.awt.event.*; import java.awt.geom.*; import javax.swing.*; import java.awt.image.*; import java.io.File; import java.io.FileOutputStream; import java.io.FileInputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.Vector; import java.io.IOException; import javax.swing.border.*; import java.awt.Color; public class GraFrame extends JFrame { JPanel contentPane; Container content = getContentPane(); //获得窗口的容器 //ScalePane showImagePane = new ScalePane(); //创建showImagePane对象用于绘制图像 FileDialog savePicture; FileInputStream picIn = null; FileOutputStream picOut = null; ObjectInputStream VIn = null; ObjectOutputStream VOut = null; Vector paintInfo = null; JMenuBar jMenuBarPic = new JMenuBar(); JMenu jMenuFile = new JMenu(); //文件 JMenuItem jMenuFileNew = new JMenuItem(); //新建 JMenuItem jMenuFileLoad = new JMenuItem(); //装载图片 JMenuItem jMenuFileSave = new JMenuItem(); //保存图片 JMenuItem jMenuFileExit = new JMenuItem();//退出 JMenu jMenuColorSel = new JMenu(); //画笔 JMenuItem jMenuPenColorSel = new JMenuItem(); //画笔颜色 JMenu jMenuIfEmpty = new JMenu(); //图形 JMenuItem jMenuItem1_w = new JMenuItem(); //实体 JMenuItem jMenuItem2_w = new JMenuItem(); //虚体 JMenu jMenuHelp = new JMenu(); //帮助 JMenuItem jMenuHelpAbout = new JMenuItem(); //帮助/关于 JToolBar jToolBarPic = new JToolBar(); PanelPic ppn = new PanelPic(); JButton jButton_ty = new JButton(); //椭圆 JButton jButton_zx = new JButton(); //直线�� JButton jButton_qc = new JButton(); //清除� JButton jButton_jx = new JButton(); //矩形���� JButton jButton_qb = new JButton(); //铅笔Ǧ�� JButton jButton_xp = new JButton(); //橡皮 JButton jButton_xz = new JButton(); //旋转 JButton jButton_tz = new JButton(); //调整图像按钮 /**Construct the frame*/ public GraFrame() { enableEvents(AWTEvent.WINDOW_EVENT_MASK); try { jbInit(); } catch (Exception e) { e.printStackTrace(); } } /**Component initialization*/ private void jbInit() throws Exception { contentPane = (JPanel) this.getContentPane(); contentPane.setLayout(null); this.getContentPane().setBackground(SystemColor.textHighlight); this.setContentPane(contentPane); this.setResizable(false); this.setSize(new Dimension(476, 376)); this.setTitle("画图板设计"); jMenuFile.setBackground(Color.lightGray); jMenuFile.setText("文件"); jMenuFileNew.setBackground(Color.lightGray); jMenuFileNew.setToolTipText(""); jMenuFileNew.setActionCommand("新建画面"); jMenuFileNew.setText("新建"); jMenuFileNew.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { jMenuFileNew_actionPerformed(e); } }); jMenuFileLoad.setBackground(Color.lightGray); jMenuFileLoad.setToolTipText(""); jMenuFileLoad.setActionCommand("加载图片"); jMenuFileLoad.setText("打开"); jMenuFileLoad.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { jMenuFileLoad_actionPerformed(e); } }); jMenuFileSave.setBackground(Color.lightGray); jMenuFileSave.setText("保存"); jMenuFileSave.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { jMenuIFileSave_actionPerformed(e); } }); jMenuFileExit.setBackground(Color.lightGray); jMenuFileExit.setText("退出"); jMenuFileExit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jMenuFileExit_actionPerformed(e); } }); jMenuHelp.setBackground(Color.lightGray); jMenuHelp.setText("帮助"); jMenuHelpAbout.setBackground(Color.lightGray); jMenuHelpAbout.setText("关于"); jMenuHelpAbout.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jMenuHelpAbout_actionPerformed(e); } }); jMenuColorSel.setBackground(Color.lightGray); jMenuColorSel.setText("颜色"); jMenuPenColorSel.setBackground(Color.lightGray); jMenuPenColorSel.setToolTipText(""); jMenuPenColorSel.setText("画笔颜色"); jMenuPenColorSel.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { jMenuPenColorSel_actionPerformed(e); } }); ppn.setBorder(BorderFactory.createLineBorder(Color.BLACK)); ppn.setBounds(new Rectangle(5, 26, 461, 296)); /*ppn.setBackground(Color.gray);**/ jMenuIfEmpty.setBackground(Color.lightGray); jMenuIfEmpty.setText("图形"); jMenuItem1_w.setBackground(Color.lightGray); jMenuItem1_w.setToolTipText(""); jMenuItem1_w.setText("实体"); jMenuItem1_w.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { jMenuItem1_w_actionPerformed(e); } }); jMenuItem2_w.setBackground(Color.lightGray); jMenuItem2_w.setText("虚体"); jMenuItem2_w.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { jMenuItem2_w_actionPerformed(e); } }); jMenuBarPic.setBackground(Color.lightGray); jMenuBarPic.setBorder(BorderFactory.createLineBorder(Color.lightGray)); contentPane.setBackground(Color.lightGray); contentPane.setBorder(BorderFactory.createLineBorder(Color.lightGray)); contentPane.setMinimumSize(new Dimension(1, 1)); contentPane.setPreferredSize(new Dimension(400, 400)); jToolBarPic.setBackground(Color.lightGray); jToolBarPic.setBorder(BorderFactory.createLineBorder(Color.black)); jToolBarPic.setBounds(new Rectangle(0, 0, 477, 22)); jButton_ty.setText("椭圆"); jButton_ty.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(MouseEvent e) { jButton_ty_mouseClicked(e); } }); jButton_ty.setBackground(Color.lightGray); jButton_ty.setBorder(BorderFactory.createLineBorder(Color.black)); jButton_ty.setToolTipText("画椭圆"); jButton_zx.setBackground(Color.lightGray); jButton_zx.setBorder(BorderFactory.createLineBorder(Color.black)); jButton_zx.setToolTipText("画直线"); jButton_zx.setText("直线"); jButton_zx.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(MouseEvent e) { jButton_zx_mouseClicked(e); } }); jButton_qc.setBackground(Color.lightGray); jButton_qc.setBorder(BorderFactory.createLineBorder(Color.black)); jButton_qc.setToolTipText("清除画板"); jButton_qc.setText("清除"); jButton_qc.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(MouseEvent e) { jButton_qc_mouseClicked(e); } }); jButton_jx.setBackground(Col
评论
    相关推荐
    • Java
      Java
    • java
      Java
    • Java
      Java
    • Java
      Java项目
    • Java
      Java 对于Java练习
    • java
      Java 此回购包括我学习Java的旅程。
    • java
      Java Java基础
    • Java
      Java
    • Java
      Java 我创建的Java项目
    • Java
      Java 2021/02/19 .java Main.java 学生.java Bmi.java 。班级 Bmi类 主类 MyBmi.class 学生班 学生样本类 2021/02/20 .java DeleteFile.java WriteFile.java MyDataPrint.java 。班级 DeleteFile.class ...