「用java制作图像」java 绘制图片

博主:adminadmin 2023-01-27 15:39:06 592

今天给各位分享用java制作图像的知识,其中也会对java 绘制图片进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!

本文目录一览:

关于java图像处理

Java图像处理技巧四则

下面代码中用到的sourceImage是一个已经存在的Image对象

图像剪切

对于一个已经存在的Image对象,要得到它的一个局部图像,可以使用下面的步骤:

//import java.awt.*;

//import java.awt.image.*;

Image croppedImage;

ImageFilter cropFilter;

CropFilter =new CropImageFilter(25,30,75,75); //四个参数分别为图像起点坐标和宽高,即CropImageFilter(int x,int y,int width,int height),详细情况请参考API

CroppedImage= Toolkit.getDefaultToolkit().createImage(new FilteredImageSource(sourceImage.getSource(),cropFilter));

如果是在Component的子类中使用,可以将上面的Toolkit.getDefaultToolkit().去掉。FilteredImageSource是一个ImageProducer对象。

图像缩放

对于一个已经存在的Image对象,得到它的一个缩放的Image对象可以使用Image的getScaledInstance方法:

Image scaledImage=sourceImage. getScaledInstance(100,100, Image.SCALE_DEFAULT); //得到一个100X100的图像

Image doubledImage=sourceImage. getScaledInstance(sourceImage.getWidth(this)*2,sourceImage.getHeight(this)*2, Image.SCALE_DEFAULT); //得到一个放大两倍的图像,这个程序一般在一个swing的组件中使用,而类Jcomponent实现了图像观察者接口ImageObserver,所有可以使用this。

//其它情况请参考API

灰度变换

下面的程序使用三种方法对一个彩色图像进行灰度变换,变换的效果都不一样。一般而言,灰度变换的算法是将象素的三个颜色分量使用R*0.3+G*0.59+ B*0.11得到灰度值,然后将之赋值给红绿蓝,这样颜色取得的效果就是灰度的。另一种就是取红绿蓝三色中的最大值作为灰度值。java核心包也有一种算法,但是没有看源代码,不知道具体算法是什么样的,效果和上述不同。

/* GrayFilter.java*/

/*@author:cherami */

/*email:cherami@163.net*/

import java.awt.image.*;

public class GrayFilter extends RGBImageFilter {

int modelStyle;

public GrayFilter() {

modelStyle=GrayModel.CS_MAX;

canFilterIndexColorModel=true;

}

public GrayFilter(int style) {

modelStyle=style;

canFilterIndexColorModel=true;

}

public void setColorModel(ColorModel cm) {

if (modelStyle==GrayModel

else if (modelStyle==GrayModel

}

public int filterRGB(int x,int y,int pixel) {

return pixel;

}

}

/* GrayModel.java*/

/*@author:cherami */

/*email:cherami@163.net*/

import java.awt.image.*;

public class GrayModel extends ColorModel {

public static final int CS_MAX=0;

public static final int CS_FLOAT=1;

ColorModel sourceModel;

int modelStyle;

public GrayModel(ColorModel sourceModel) {

super(sourceModel.getPixelSize());

this.sourceModel=sourceModel;

modelStyle=0;

}

public GrayModel(ColorModel sourceModel,int style) {

super(sourceModel.getPixelSize());

this.sourceModel=sourceModel;

modelStyle=style;

}

public void setGrayStyle(int style) {

modelStyle=style;

}

protected int getGrayLevel(int pixel) {

if (modelStyle==CS_MAX) {

return Math.max(sourceModel.getRed(pixel),Math.max(sourceModel.getGreen(pixel),sourceModel.getBlue(pixel)));

}

else if (modelStyle==CS_FLOAT){

return (int)(sourceModel.getRed(pixel)*0.3+sourceModel.getGreen(pixel)*0.59+sourceModel.getBlue(pixel)*0.11);

}

else {

return 0;

}

}

public int getAlpha(int pixel) {

return sourceModel.getAlpha(pixel);

}

public int getRed(int pixel) {

return getGrayLevel(pixel);

}

public int getGreen(int pixel) {

return getGrayLevel(pixel);

}

public int getBlue(int pixel) {

return getGrayLevel(pixel);

}

public int getRGB(int pixel) {

int gray=getGrayLevel(pixel);

return (getAlpha(pixel)24)+(gray16)+(gray8)+gray;

}

}

如果你有自己的算法或者想取得特殊的效果,你可以修改类GrayModel的方法getGrayLevel()。

色彩变换

根据上面的原理,我们也可以实现色彩变换,这样的效果就很多了。下面是一个反转变换的例子:

/* ReverseColorModel.java*/

/*@author:cherami */

/*email:cherami@163.net*/

import java.awt.image.*;

public class ReverseColorModel extends ColorModel {

ColorModel sourceModel;

public ReverseColorModel(ColorModel sourceModel) {

super(sourceModel.getPixelSize());

this.sourceModel=sourceModel;

}

public int getAlpha(int pixel) {

return sourceModel.getAlpha(pixel);

}

public int getRed(int pixel) {

return ~sourceModel.getRed(pixel);

}

public int getGreen(int pixel) {

return ~sourceModel.getGreen(pixel);

}

public int getBlue(int pixel) {

return ~sourceModel.getBlue(pixel);

}

public int getRGB(int pixel) {

return (getAlpha(pixel)24)+(getRed(pixel)16)+(getGreen(pixel)8)+getBlue(pixel);

}

}

/* ReverseColorModel.java*/

/*@author:cherami */

/*email:cherami@163.net*/

import java.awt.image.*;

public class ReverseFilter extends RGBImageFilter {

public ReverseFilter() {

canFilterIndexColorModel=true;

}

public void setColorModel(ColorModel cm) {

substituteColorModel(cm,new ReverseColorModel(cm));

}

public int filterRGB(int x,int y,int pixel) {

return pixel;

}

}

要想取得自己的效果,需要修改ReverseColorModel.java中的三个方法,getRed、getGreen、getBlue。

下面是上面的效果的一个总的演示程序。

/*GrayImage.java*/

/*@author:cherami */

/*email:cherami@163.net*/

import java.awt.*;

import java.awt.image.*;

import javax.swing.*;

import java.awt.color.*;

public class GrayImage extends JFrame{

Image source,gray,gray3,clip,bigimg;

BufferedImage bimg,gray2;

GrayFilter filter,filter2;

ImageIcon ii;

ImageFilter cropFilter;

int iw,ih;

public GrayImage() {

ii=new ImageIcon(\"images/11.gif\");

source=ii.getImage();

iw=source.getWidth(this);

ih=source.getHeight(this);

filter=new GrayFilter();

filter2=new GrayFilter(GrayModel.CS_FLOAT);

gray=createImage(new FilteredImageSource(source.getSource(),filter));

gray3=createImage(new FilteredImageSource(source.getSource(),filter2));

cropFilter=new CropImageFilter(5,5,iw-5,ih-5);

clip=createImage(new FilteredImageSource(source.getSource(),cropFilter));

bigimg=source.getScaledInstance(iw*2,ih*2,Image.SCALE_DEFAULT);

MediaTracker mt=new MediaTracker(this);

mt.addImage(gray,0);

try {

mt.waitForAll();

} catch (Exception e) {

}

用java编写一个图像处理,光线补偿 、

写了很多篇关于图像处理的文章,没有一篇介绍Java 2D的图像处理API,文章讨论和提及的

API都是基于JDK6的,首先来看Java中如何组织一个图像对象BufferedImage的,如图:

一个BufferedImage的像素数据储存在Raster中,ColorModel里面储存颜色空间,类型等

信息,当前Java只支持一下三种图像格式- JPG,PNG,GIF,如何向让Java支持其它格式,首

先要 完成Java中的图像读写接口,然后打成jar,加上启动参数- Xbootclasspath/p

newimageformatIO.jar即可。

Java中如何读写一个图像文件,使用ImageIO对象即可。读图像文件的代码如下:

File file = new File("D:\\test\\blue_flower.jpg");

BufferedImage image = ImageIO.read(file);

写图像文件的代码如下:

File outputfile = new File("saved.png");

ImageIO.write(bufferedImage, "png",outputfile);

从BufferedImage对象中读取像素数据的代码如下:

1 int type= image.getType();2 if ( type ==BufferedImage.TYPE_INT_ARGB || type == BufferedImage.TYPE_INT_RGB )3      return (int [])image.getRaster().getDataElements(x, y, width, height, pixels );4 else5     return image.getRGB( x, y, width, height, pixels, 0, width );

首先获取图像类型,如果不是32位的INT型数据,直接读写RGB值即可,否则需要从Raster

对象中读取。

往BufferedImage对象中写入像素数据同样遵守上面的规则。代码如下:

1 int type= image.getType();2 if ( type ==BufferedImage.TYPE_INT_ARGB || type == BufferedImage.TYPE_INT_RGB )3    image.getRaster().setDataElements(x, y, width, height, pixels );4 else5    image.setRGB(x, y, width, height, pixels, 0, width );

读取图像可能因为图像文件比较大,需要一定时间的等待才可以,Java Advance Image

Processor API提供了MediaTracker对象来跟踪图像的加载,同步其它操作,使用方法如下:

MediaTracker tracker = new MediaTracker(this); //初始化对象 om/roucheng/tracker.addImage(image_01, 1); // 加入要跟踪的BufferedImage对象image_001tracker.waitForID(1, 10000) // 等待10秒,让iamge_01图像加载

从一个32位int型数据cARGB中读取图像RGB颜色值的代码如下:

1 int alpha = (cARGB 24) 0xff; //透明度通道 g/2 int red = (cARGB 16) 0xff;3 int green = (cARGB 8) 0xff;4 int blue = cARGB 0xff;

将RGB颜色值写入成一个INT型数据cRGB的代码如下:

cRGB = (alpha 24) | (red 16) | (green 8) | blue;

创建一个BufferedImage对象的代码如下:

BufferedImage image = newBufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB);

一个完整的源代码Demo如下:

1 package com.gloomyfish.swing;  2   3 import java.awt.BorderLayout;  4 import java.awt.Dimension;  5 import java.awt.Graphics;  6 import java.awt.Graphics2D;  7 import java.awt.RenderingHints;  8 import java.awt.image.BufferedImage;  9 import java.io.File; 10 import java.io.IOException; 11  12 import javax.imageio.ImageIO; 13 import javax.swing.JComponent; 14 import javax.swing.JFrame; 15  16 public class PlasmaDemo extends JComponent {

17    18     /**  19      *

20      */   21     private static final long serialVersionUID = -2236160343614397287L;

22     private BufferedImage image = null;

23     private int size = 256; 24        25     public PlasmaDemo() {

26         super();

27         this.setOpaque(false);

28     }

29        30     protected void paintComponent(Graphics g) {

31         Graphics2D g2 = (Graphics2D)g;

32         g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

33         g2.drawImage(getImage(), 5, 5, image.getWidth(), image.getHeight(), null);

34     }

35        36     private BufferedImage getImage() {

37         if(image == null) {

38             image = new BufferedImage(size, size, BufferedImage.TYPE_INT_ARGB);

39             int[] rgbData = new int[size*size];

40             generateNoiseImage(rgbData);

41             setRGB(image, 0, 0, size, size, rgbData); 42             File outFile = new File("plasma.jpg"); 43             try { 44                 ImageIO.write(image, "jpg", outFile); 45             } catch (IOException e) { 46                 e.printStackTrace(); 47             } 48         }

49         return image;

50     }

51        52     public void generateNoiseImage(int[] rgbData) {

53         int index = 0;

54         int a = 255;

55         int r = 0;

56         int g = 0;

57         int b = 0;

58   59         for(int row=0; rowsize; row++) {

60             for(int col=0; colsize; col++) {

61                 // set random color value for each pixel   62                 r = (int)(128.0 + (128.0 * Math.sin((row + col) / 8.0)));

63                 g = (int)(128.0 + (128.0 * Math.sin((row + col) / 8.0)));

64                 b = (int)(128.0 + (128.0 * Math.sin((row + col) / 8.0)));

65                    66                 rgbData[index] = ((clamp(a) 0xff) 24) |

67                                 ((clamp(r) 0xff) 16)  |

68                                 ((clamp(g) 0xff) 8)   |

69                                 ((clamp(b) 0xff));

70                 index++;

71             }

72         }

73            74     }

75        76     private int clamp(int rgb) {

77         if(rgb 255)

78             return 255;

79         if(rgb 0)

80             return 0;

81         return rgb;

82     }

83    84     public void setRGB( BufferedImage image, int x, int y, int width, int height, int[] pixels ) {

85         int type = image.getType();

86         if ( type == BufferedImage.TYPE_INT_ARGB || type == BufferedImage.TYPE_INT_RGB )

87             image.getRaster().setDataElements( x, y, width, height, pixels );

88         else   89             image.setRGB( x, y, width, height, pixels, 0, width );

90     }

91        92     public static void main(String[] args) {

93         JFrame frame = new JFrame("Noise Art Panel");

94         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

95         frame.getContentPane().setLayout(new BorderLayout()); m/roucheng/ 98         frame.getContentPane().add(new PlasmaDemo(), BorderLayout.CENTER);

99         frame.setPreferredSize(new Dimension(400 + 25,450));  

100         frame.pack();  

101         frame.setVisible(true);  

102     }  

103 }  

怎么用java绘制函数图像

package math;

import java.awt.BorderLayout;

import java.awt.Dimension;

import java.awt.GridLayout;

import java.awt.Toolkit;

import javax.swing.ButtonGroup;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPanel;

import javax.swing.JRadioButton;

import javax.swing.JTextField;

public class UI extends JFrame

{

MyPanel mp;

JPanel pl = new JPanel();

JPanel pl1 = new JPanel(),

pl2 = new JPanel(),

pl3 = new JPanel(),

pl4 = new JPanel();

JRadioButton rb1,rb2;

ButtonGroup bg = new ButtonGroup();

JTextField tf = new JTextField(16);

String[] s = {"y = sin(x)", "y = cos(x)", "y = tan(x)",

"y = pow(x, 2)", "y = pow(x, 3)", "y = log(x)",

"y = pow(2, x)", "y = sqrt(x)", "r = a(sita)"};

JComboBox cb;

JButton bn1 = new JButton("变宽"),

bn2 = new JButton("变窄"),

bn3 = new JButton("拉长"),

bn4 = new JButton("压短"),

bn = new JButton("绘图"),

exit = new JButton("退出"),

bn5 = new JButton("左移"),

bn6 = new JButton("右移"),

bn7 = new JButton("上移"),

bn8 = new JButton("下移");

public UI()

{

mp = new MyPanel(this);

pl1.setLayout(new GridLayout(1, 2));

pl2.setLayout(new GridLayout(1, 2));

pl3.setLayout(new GridLayout(1, 2));

pl4.setLayout(new GridLayout(1, 2));

pl1.add(bn1); bn1.setEnabled(false);

pl1.add(bn2); bn2.setEnabled(false);

pl2.add(bn3); bn3.setEnabled(false);

pl2.add(bn4); bn4.setEnabled(false);

pl3.add(bn5); bn5.setEnabled(false);

pl3.add(bn6); bn6.setEnabled(false);

pl4.add(bn7); bn7.setEnabled(false);

pl4.add(bn8); bn8.setEnabled(false);

pl.setLayout(new GridLayout(20, 1));

rb1 = new JRadioButton("输入函数");

rb2 = new JRadioButton("选择已有函数");

rb2.setSelected(true);

tf.setEnabled(false);

bg.add(rb1); bg.add(rb2);

rb1.addActionListener(mp);

rb2.addActionListener(mp);

pl.add(rb1);

pl.add(tf);

pl.add(rb2);

cb = new JComboBox(s);

pl.add(cb);

pl.add(new JLabel());

pl.add(pl1); pl.add(pl2);

pl.add(pl3); pl.add(pl4);

pl.add(bn);

pl.add(exit);

bn1.addActionListener(mp);

bn2.addActionListener(mp);

bn3.addActionListener(mp);

bn4.addActionListener(mp);

bn5.addActionListener(mp);

bn6.addActionListener(mp);

bn7.addActionListener(mp);

bn8.addActionListener(mp);

bn.addActionListener(mp);

exit.addActionListener(mp);

this.setLayout(new BorderLayout());

this.add(mp, BorderLayout.CENTER);

this.add(pl, BorderLayout.EAST);

this.setTitle("平面直角坐标系画图小工具");

this.setSize(797, 600 + 37);

Dimension dn = Toolkit.getDefaultToolkit().getScreenSize();

this.setLocation((dn.width - 797) / 2, (dn.height - 637) / 2);

this.setVisible(true);

this.setDefaultCloseOperation(3);

}

public static void main(String[] args)

{

new UI();

}

}

package math;

import java.awt.Color;

import java.awt.Graphics;

import java.awt.Graphics2D;

import java.awt.Point;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.awt.event.MouseEvent;

import java.awt.event.MouseMotionListener;

import java.awt.geom.Ellipse2D;

import java.awt.geom.Line2D;

import javax.swing.JOptionPane;

import javax.swing.JPanel;

public class MyPanel extends JPanel implements ActionListener,MouseMotionListener

{

UI ui;

int flag;

double h_times;

int w_times;

int dx;

int dy;

String str;

Point pt = new Point(0, 0);

void init()

{

flag = -1;

h_times = Math.PI / 100;

w_times = 100;

dx = 300;

dy = 300;

}

public MyPanel(UI ui)

{

this.addMouseMotionListener(this);

init();

this.ui = ui;

}

public void paintComponent(Graphics g)

{

super.paintComponent(g);

Graphics2D g2 = (Graphics2D)g;

drawCoordinate(g2);

Line2D line;

g2.setColor(Color.BLUE);

g2.drawString("(" + (pt.x - 300) + ", " + (300 - pt.y) + ")", pt.x + 20, pt.y + 20);

switch(flag)

{

case 0:

g2.drawString("y = Asin(Bx + C) + D", 105, 60);

for(double i = 0; i 600; i += 0.01)

{

line = new Line2D.Double(i, dy - Math.sin(getReal_X(i)) * w_times, i + 1, dy - Math.sin(getReal_X(i + 1)) * w_times);

g2.draw(line);

}

break;

case 1:

g2.drawString("y = Acos(Bx + C) + D", 105, 60);

for(double i = 0; i 600; i += 0.01)

{

line = new Line2D.Double(i, dy - Math.cos(getReal_X(i)) * w_times, i + 1, dy - Math.cos(getReal_X(i + 1)) * w_times);

g2.draw(line);

}

break;

case 2:

g2.drawString("y = Atan(Bx + C) + D", 105, 60);

for(double i = 0; i 600; i += 0.01)

{

line = new Line2D.Double(i, dy - Math.tan(getReal_X(i)) * w_times, i + 1, dy - Math.tan(getReal_X(i + 1)) * w_times);

g2.draw(line);

}

break;

case 3:

g2.drawString("y = Apow(Bx + C, 2) + D", 105, 60);

for(double i = 0; i 600; i += 0.01)

{

line = new Line2D.Double(i, dy - Math.pow(getReal_X(i), 2) * w_times, i + 1, dy - Math.pow(getReal_X(i + 1), 2) * w_times);

g2.draw(line);

}

break;

case 4:

g2.drawString("y = Apow(Bx + C, 3) + D", 105, 60);

for(double i = 0; i 600; i += 0.01)

{

line = new Line2D.Double(i, dy - Math.pow(getReal_X(i), 3) * w_times, i + 1, dy - Math.pow(getReal_X(i + 1), 3) * w_times);

g2.draw(line);

}

break;

case 5:

g2.drawString("y = Alog(Bx + C) + D", 105, 60);

for(double i = 0; i 600; i += 0.01)

{

line = new Line2D.Double(i, dy - Math.log(getReal_X(i)) * w_times, i + 1, dy - Math.log(getReal_X(i + 1)) * w_times);

g2.draw(line);

}

break;

case 6:

g2.drawString("y = Apow(2, Bx + C) + D", 105, 60);

for(double i = 0; i 600; i += 0.01)

{

line = new Line2D.Double(i, dy - Math.pow(2, getReal_X(i)) * w_times, i + 1, dy - Math.pow(2, getReal_X(i + 1)) * w_times);

g2.draw(line);

}

break;

case 7:

g2.drawString("y = Asqrt(Bx + C) + D", 105, 60);

for(double i = 0; i 600; i += 0.01)

{

line = new Line2D.Double(i, dy - Math.sqrt(getReal_X(i)) * w_times, i + 1, dy - Math.sqrt(getReal_X(i + 1)) * w_times);

g2.draw(line);

}

break;

case 8:

g2.drawString("y = a(sita)", 105, 60);

for(double i = 0; i 600; i += 0.01)

{

line = new Line2D.Double(getReal_X(i) * Math.cos(getReal_X(i)), dy - getReal_X(i) * Math.sin(getReal_X(i)) * w_times, getReal_X(i) * Math.cos(getReal_X(i + 1)), dy - getReal_X(i) * Math.sin(getReal_X(i + 1)) * w_times);

g2.draw(line);

}

break;

}

if(flag != -1)

{

g2.drawString("A = " + w_times, 105, 90);

g2.drawString("B= " + h_times, 105, 120);

g2.drawString("C= " + (300 - dx), 105, 150);

g2.drawString("D= " + (300 - dy), 105, 180);

}

}

private double getReal_X(double x)

{

return (x - dx) * h_times;

}

private void drawCoordinate(Graphics2D g2)

{

int len = 20;

Line2D line;

for(int i = 0; i = 600 / len; i++)

{

g2.setColor(Color.PINK.darker());

if(i == 300 / len)

g2.setColor(Color.RED);

else;

line = new Line2D.Double(0, i * len, 600, i * len);

g2.draw(line);

line = new Line2D.Double(i * len, 0, i * len, 600);

g2.draw(line);

}

drawPoint(g2, 300, 300);

}

private void drawPoint(Graphics2D g2, double x, double y)

{

g2.setColor(Color.YELLOW);

Ellipse2D circle = new Ellipse2D.Double(x - 2, y - 2, 4, 4);

g2.fill(circle);

}

public void actionPerformed(ActionEvent e)

{

if(e.getSource() == ui.rb1)

{

ui.tf.setEnabled(true);

ui.cb.setEnabled(false);

flag = -1;

}

if(e.getSource() == ui.rb2)

{

ui.tf.setEnabled(false);

ui.cb.setEnabled(true);

}

if(e.getSource() == ui.bn1)

{

h_times /= 1.1;

}

if(e.getSource() == ui.bn2)

{

h_times *= 1.1;

}

if(e.getSource() == ui.bn3)

{

// ui.bn4.setEnabled(true);

w_times += 10;

// if(w_times = 300)

// ui.bn3.setEnabled(false);

}

if(e.getSource() == ui.bn4)

{

// ui.bn3.setEnabled(true);

w_times -= 10;

// if(w_times = 0)

// ui.bn4.setEnabled(false);

}

if(e.getSource() == ui.bn5)

{

dx -= 10;

}

if(e.getSource() == ui.bn6)

{

dx += 10;

}

if(e.getSource() == ui.bn7)

{

// ui.bn8.setEnabled(true);

dy -= 10;

// if(dy = 0)

// ui.bn7.setEnabled(false);

}

if(e.getSource() == ui.bn8)

{

// ui.bn7.setEnabled(true);

dy += 10;

// if(dy = 600)

// ui.bn8.setEnabled(false);

}

if(e.getSource() == ui.bn)

{

if(ui.tf.isEnabled() == true)

{

str = ui.tf.getText();

if(str == null || str.length() == 0)

{

ui.bn1.setEnabled(false);

ui.bn2.setEnabled(false);

ui.bn3.setEnabled(false);

ui.bn4.setEnabled(false);

ui.bn5.setEnabled(false);

ui.bn6.setEnabled(false);

ui.bn7.setEnabled(false);

ui.bn8.setEnabled(false);

JOptionPane.showMessageDialog(this, "请输入函数表达式 !");

return;

}

}else flag = -2;

ui.bn1.setEnabled(true);

ui.bn2.setEnabled(true);

ui.bn3.setEnabled(true);

ui.bn4.setEnabled(true);

ui.bn5.setEnabled(true);

ui.bn6.setEnabled(true);

ui.bn7.setEnabled(true);

ui.bn8.setEnabled(true);

init();

if(ui.cb.isEnabled() == true)

{

flag = ui.cb.getSelectedIndex();

}

}

if(e.getSource() == ui.exit)

System.exit(0);

repaint();

}

public void mouseDragged(MouseEvent arg0)

{

}

public void mouseMoved(MouseEvent e)

{

pt = e.getPoint();

repaint();

}

}

用java制作图像的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于java 绘制图片、用java制作图像的信息别忘了在本站进行查找喔。