请问有谁能提供java编的画板的源代码?

作者&投稿:大德 (若有异议请与网页底部的电邮联系)
求用java写的画板源代码,要求跟操作系统的差不多~

楼上佩服你了,正准备回答这题,发现你用的是我用过的程序,用我的程序去回答问题以后请标明转载好不
____________________________________________________________________
我也不稀罕这分,你拿去好了。只是转载别人的时候著名作者是对别人的尊重,既然你不是有意我就不多说了,算我反应激烈了

楼上的代码我做了一点点改正,我想现在可以正常运行了:
//#8.15
//#filename: ShapeMain.java
import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.Color;
import java.awt.Container;
import java.awt.Graphics;
import java.awt.Panel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionAdapter;
import java.awt.event.MouseMotionListener;

import javax.swing.ButtonGroup;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;
//import javax.swing.Component;


public class ShapeMain extends JFrame implements ActionListener,MouseListener,MouseMotionListener{
int x,y,x1,y1,x2,y2,width,height;
boolean isFirstPoint = true;
//初始化开始画的是线
int drawType = PaintingGround.LINE;
//初始化开始不是填充
boolean isFill = false;
//添加控件
ButtonGroup btg = new ButtonGroup();
Button btLine = new Button("线");
Button btRectangle = new Button("矩形");
Button btRound = new Button("圆");
Button btEllipse = new Button("椭圆");
Button tbFillState = new Button("填充");
Button button3 = new Button("文本操作");
Button button2 = new Button("清除");
Button button1 = new Button("选择颜色");

Panel buttonPanel = new Panel();
PaintingGround paintingGround = new PaintingGround();
//Main Method
public static void main(String[] args) {
//设置显示外观
try{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}catch(Exception e) {
e.printStackTrace();
}
new ShapeMain();
}

//构造函数
public ShapeMain() {
//控件添加到控件组中
// btg.add(btLine);
// btg.add(btRectangle);
// btg.add(btRound);
// btg.add(btEllipse);


buttonPanel.add(btLine);
buttonPanel.add(btRectangle);
buttonPanel.add(btRound);
buttonPanel.add(btEllipse);
buttonPanel.add(tbFillState);

//设置容器及容器的整体布局
Container cp = this;

cp.setLayout(new BorderLayout());

cp.add(BorderLayout.NORTH,buttonPanel);
cp.add(BorderLayout.CENTER,paintingGround);
//cp.add(BorderLayout.SOUTH,jf);
//jf.setJMenuBar(mb);
setLocation(300,150);
setSize(600,480);
setVisible(true);

setDefaultCloseOperation(EXIT_ON_CLOSE);
//添加鼠标触发事件
paintingGround.addMouseListener(new MouseAdapter() {
public void mouseReleased(MouseEvent evn) {
isFirstPoint = true;
}
});
//对鼠标的输入进行判断并调用画图程序
paintingGround.addMouseMotionListener(new MouseMotionAdapter() {
public void mouseDragged(MouseEvent evn) {
if(isFirstPoint) {
x1 = evn.getX();
y1 = evn.getY();
isFirstPoint = false;
}
else {
x2 = evn.getX();
y2 = evn.getY();
switch(drawType) {
case PaintingGround.LINE:
//画线
paintingGround.drawLine(x1,y1,x2,y2);
break;
case PaintingGround.RECTANGLE:
//画矫形
paintingGround.drawRect(x1,y1,x2-x1,y2-y1);
break;
case PaintingGround.ROUND:
//画圆
//两点距离公式
int size = Math.abs((int)Math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)));
paintingGround.drawRound(x1,y1,size);
break;
case PaintingGround.ELLIPSE:
//画椭圆
paintingGround.drawEllipse(x1,y1,x2-x1,y2-y1);
break;
default:
break;
}
}
}
});
//各个控件的触发事件
btLine.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent evn) {
drawType = PaintingGround.LINE;
}
});

btRectangle.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent evn) {
drawType = PaintingGround.RECTANGLE;
}
});

btRound.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent evn) {
drawType = PaintingGround.ROUND;
}
});

btEllipse.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent evn) {
drawType = PaintingGround.ELLIPSE;
}
});

tbFillState.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent evn) {
isFill = tbFillState.isShowing();
paintingGround.setFillState(isFill);
}
});
}

public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub

}

public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub

}

public void mousePressed(MouseEvent e) {
// TODO Auto-generated method stub

}

public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub

}

public void mouseEntered(MouseEvent e) {
// TODO Auto-generated method stub

}

public void mouseExited(MouseEvent e) {
// TODO Auto-generated method stub

}

public void mouseDragged(MouseEvent e) {
// TODO Auto-generated method stub

}

public void mouseMoved(MouseEvent e) {
// TODO Auto-generated method stub

}
}

class PaintingGround extends JPanel {
public static final int LINE = 1;
public static final int RECTANGLE = 2;
public static final int ROUND = 3;
public static final int ELLIPSE = 4;

private int x,y;
private int x1,y1,x2,y2;
private int width, height,size;
private int drawType = 0;
private boolean isFill = false;
//构造函数
public PaintingGround() {
setBackground(Color.black);
}
//判断是用实心还是空心的,
public void paint(Graphics g) {
super.paint(g);
g.setColor(Color.white);
if(isFill) {
switch(drawType) {
case LINE:
g.drawLine(x1,y1,x2,y2);
break;
case RECTANGLE:
g.fillRect(x,y,width,height);
break;
case ROUND:
g.fillOval(x,y,size,size);
break;
case ELLIPSE:
g.fillOval(x,y,width,height);
break;
default:
break;
}
}
else {
switch(drawType) {
case LINE:
g.drawLine(x1,y1,x2,y2);
break;
case RECTANGLE:
g.drawRect(x,y,width,height);
break;
case ROUND:
g.drawOval(x,y,size,size);
break;
case ELLIPSE:
g.drawOval(x,y,width,height);
break;
default:
break;
}
}
}

public void drawLine(int x1, int y1, int x2,int y2) {
this.x1 = x1;
this.y1 = y1;
this.x2 = x2;
this.y2 = y2;

drawType = LINE;
repaint();
}
//具体的实现方式
public void drawRect(int x,int y,int width, int height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
drawType = RECTANGLE;
repaint();
}

public void drawRound(int x,int y,int size) {
this.x = x;
this.y = y;
this.size = size;
drawType = ROUND;
repaint();
}

public void drawEllipse(int x,int y,int width,int height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
drawType = ELLIPSE;
repaint();
}

public void setFillState(boolean isFill) {
this.isFill = isFill;
}

}

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

class Point implements Serializable
{
int x,y;
Color col;
int tool;
int boarder;

Point(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;
}
}

class paintboard extends Frame implements ActionListener,MouseMotionListener,MouseListener,ItemListener
{
int x = -1, y = -1;
int con = 1;//画笔大小
int Econ = 5;//橡皮大小

int toolFlag = 0;//toolFlag:工具标记
//toolFlag工具对应表:
//(0--画笔);(1--橡皮);(2--清除);
//(3--直线);(4--圆);(5--矩形);

Color c = new Color(0,0,0); //画笔颜色
BasicStroke size = new BasicStroke(con,BasicStroke.CAP_BUTT,BasicStroke.JOIN_BEVEL);//画笔粗细
Point cutflag = new Point(-1, -1, c, 6, con);//截断标志

Vector paintInfo = null;//点信息向量组
int n = 1;

FileInputStream picIn = null;
FileOutputStream picOut = null;

ObjectInputStream VIn = null;
ObjectOutputStream VOut = null;

// *工具面板--画笔,直线,圆,矩形,多边形,橡皮,清除*/
Panel toolPanel;
Button eraser, drLine,drCircle,drRect;
Button clear ,pen;
Choice ColChoice,SizeChoice,EraserChoice;
Button colchooser;
Label 颜色,大小B,大小E;
//保存功能
Button openPic,savePic;
FileDialog openPicture,savePicture;

paintboard(String s)
{
super(s);
addMouseMotionListener(this);
addMouseListener(this);

paintInfo = new Vector();

/*各工具按钮及选择项*/
//颜色选择
ColChoice = new Choice();
ColChoice.add("black");
ColChoice.add("red");
ColChoice.add("blue");
ColChoice.add("green");
ColChoice.addItemListener(this);
//画笔大小选择
SizeChoice = new Choice();
SizeChoice.add("1");
SizeChoice.add("3");
SizeChoice.add("5");
SizeChoice.add("7");
SizeChoice.add("9");
SizeChoice.addItemListener(this);
//橡皮大小选择
EraserChoice = new Choice();
EraserChoice.add("5");
EraserChoice.add("9");
EraserChoice.add("13");
EraserChoice.add("17");
EraserChoice.addItemListener(this);
////////////////////////////////////////////////////
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("保存图画");

colchooser = new Button("显示调色板");

//各组件事件监听
clear.addActionListener(this);
eraser.addActionListener(this);
pen.addActionListener(this);
drLine.addActionListener(this);
drCircle.addActionListener(this);
drRect.addActionListener(this);
openPic.addActionListener(this);
savePic.addActionListener(this);
colchooser.addActionListener(this);

颜色 = new Label("画笔颜色",Label.CENTER);
大小B = new Label("画笔大小",Label.CENTER);
大小E = new Label("橡皮大小",Label.CENTER);
//面板添加组件
toolPanel.add(openPic);
toolPanel.add(savePic);

toolPanel.add(pen);
toolPanel.add(drLine);
toolPanel.add(drCircle);
toolPanel.add(drRect);

toolPanel.add(颜色); toolPanel.add(ColChoice);
toolPanel.add(大小B); toolPanel.add(SizeChoice);
toolPanel.add(colchooser);

toolPanel.add(eraser);
toolPanel.add(大小E); toolPanel.add(EraserChoice);

toolPanel.add(clear);
//工具面板到APPLET面板
add(toolPanel,BorderLayout.NORTH);

setBounds(60,60,900,600); setVisible(true);
validate();
//dialog for save and load

openPicture = new FileDialog(this,"打开图画",FileDialog.LOAD);
openPicture.setVisible(false);
savePicture = new FileDialog(this,"保存图画",FileDialog.SAVE);
savePicture.setVisible(false);

openPicture.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{ openPicture.setVisible(false); }
});

savePicture.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{ savePicture.setVisible(false); }
});

addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{ System.exit(0);}
});

}

public void paint(Graphics g)
{
Graphics2D g2d = (Graphics2D)g;

Point p1,p2;

n = paintInfo.size();

if(toolFlag==2)
g.clearRect(0,0,getSize().width,getSize().height);//清除

for(int i=0; i<n ;i++){
p1 = (Point)paintInfo.elementAt(i);
p2 = (Point)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)
{
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 :
}//end switch
}//end if
}//end for
}

public void itemStateChanged(ItemEvent e)
{
if(e.getSource()==ColChoice)//预选颜色
{
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);}
}
else if(e.getSource()==SizeChoice)//画笔大小
{
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);

}
}
else if(e.getSource()==EraserChoice)//橡皮大小
{
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; }

}

}

public void mouseDragged(MouseEvent e)
{
Point p1 ;
switch(toolFlag){
case 0://画笔
x = (int)e.getX();
y = (int)e.getY();
p1 = new Point(x, y, c, toolFlag, con);
paintInfo.addElement(p1);
repaint();
break;

case 1://橡皮
x = (int)e.getX();
y = (int)e.getY();
p1 = new Point(x, y, null, toolFlag, Econ);
paintInfo.addElement(p1);
repaint();
break;

default :
}
}

public void mouseMoved(MouseEvent e) {}

public void update(Graphics g)
{
paint(g);
}

public void mousePressed(MouseEvent e)
{
Point p2;
switch(toolFlag){
case 3://直线
x = (int)e.getX();
y = (int)e.getY();
p2 = new Point(x, y, c, toolFlag, con);
paintInfo.addElement(p2);
break;

case 4: //圆
x = (int)e.getX();
y = (int)e.getY();
p2 = new Point(x, y, c, toolFlag, con);
paintInfo.addElement(p2);
break;

case 5: //矩形
x = (int)e.getX();
y = (int)e.getY();
p2 = new Point(x, y, c, toolFlag, con);
paintInfo.addElement(p2);
break;

default :
}
}

public void mouseReleased(MouseEvent e)
{
Point p3;
switch(toolFlag){
case 0://画笔
paintInfo.addElement(cutflag);
break;

case 1: //eraser
paintInfo.addElement(cutflag);
break;

case 3://直线
x = (int)e.getX();
y = (int)e.getY();
p3 = new Point(x, y, c, toolFlag, con);
paintInfo.addElement(p3);
paintInfo.addElement(cutflag);
repaint();
break;

case 4: //圆
x = (int)e.getX();
y = (int)e.getY();
p3 = new Point(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 Point(x, y, c, toolFlag, con);
paintInfo.addElement(p3);
paintInfo.addElement(cutflag);
repaint();
break;

default:
}
}

public void mouseEntered(MouseEvent e){}

public void mouseExited(MouseEvent e){}

public void mouseClicked(MouseEvent e){}

public void actionPerformed(ActionEvent e)
{

if(e.getSource()==pen)//画笔
{toolFlag = 0;}

if(e.getSource()==eraser)//橡皮
{toolFlag = 1;}

if(e.getSource()==clear)//清除
{
toolFlag = 2;
paintInfo.removeAllElements();
repaint();
}

if(e.getSource()==drLine)//画线
{toolFlag = 3;}

if(e.getSource()==drCircle)//画圆
{toolFlag = 4;}

if(e.getSource()==drRect)//画矩形
{toolFlag = 5;}

if(e.getSource()==colchooser)//调色板
{
Color newColor = JColorChooser.showDialog(this,"调色板",c);
c = newColor;
}

if(e.getSource()==openPic)//打开图画
{

openPicture.setVisible(true);

if(openPicture.getFile()!=null)
{
int tempflag;
tempflag = toolFlag;
toolFlag = 2 ;
repaint();

try{
paintInfo.removeAllElements();
File filein = new File(openPicture.getDirectory(),openPicture.getFile());
picIn = new FileInputStream(filein);
VIn = new ObjectInputStream(picIn);
paintInfo = (Vector)VIn.readObject();
VIn.close();
repaint();
toolFlag = tempflag;

}

catch(ClassNotFoundException IOe2)
{
repaint();
toolFlag = tempflag;
System.out.println("can not read object");
}
catch(IOException IOe)
{
repaint();
toolFlag = tempflag;
System.out.println("can not read file");
}
}

}

if(e.getSource()==savePic)//保存图画
{
savePicture.setVisible(true);
try{
File fileout = new File(savePicture.getDirectory(),savePicture.getFile());
picOut = new FileOutputStream(fileout);
VOut = new ObjectOutputStream(picOut);
VOut.writeObject(paintInfo);
VOut.close();
}
catch(IOException IOe)
{
System.out.println("can not write object");
}

}
}
}//end paintboard

public class pb
{
public static void main(String args[])
{ new paintboard("画图程序"); }
}


关于黑客的问题 悬赏100!!!
5 黑客啊 黑客破解 盗号的是骇客 破坏资料的也是骇客 要把黑客和骇客分清楚 黑客 一般是 电脑网络的发烧友 对网络充满了兴趣 可以说是疯狂的 要掌握很多技术 6 这个简单 在百度网页上 打上 黑客 你就可以找到很多 网站了 你自己看那个好就那个把 我看都是那个样 7 恩 在某种关系上 和编程是有...

jav啊新手问题:(int)5.2\/2.5 此语句执行时的顺序是什么,求详细点的过...
(int)5.2\/2.5 会按照从左到右的执行顺序,先进行int类型转换将5.2 -> 5 然后 5\/2.5 输出 2.0 。int 和 float数据类型做运算,结果是float类型。

jav低排座位每往后一排增加一次问m是多少
因为是从第三排起,每个后一排比前一排多一个座位 则可以先把第一排的去掉,剩下的都是后一排比前一排多一个座位 则共有:34-1=33排 最后一排会比现在的第一排多:(33-1)×1=32个 则最后一排有:m+32

为什么JAV连续几天都登不上去
二、DNS服务器的问题 当IE无法浏览网页时,可先尝试用IP地址来访问,如果可以访问,那么应该是DNS的问题,造成DNS的问题可能是连网时获取DNS出错或DNS服务器本身问题,这时你可以手动指定DNS服务(地址可以是你当地ISP提供的DNS服务器地址,也可以用其它地方可正常使用DNS服务器地址。在网络的属性里进行(...

帮我看看这段javcscript代码有什么问题
看看这个 计算器 <FORM name="Keypad" action=""> <TABLE align="center"> <B> <TABLE align="center" border=2 width=50 height=60 cellpadding=1 cellspacing=5> <TR> <TD colspan=3 align=middle><\/TD> <TD><\/TD> <TD><\/TD> <TD>...

oppo+jav系列的888处理器手机怎么样?
OPPO尚未发布搭载888处理器的手机。然而,888处理器是高通公司的旗舰级芯片,具备强大的性能和先进的功能。根据888处理器的规格,它采用了5nm工艺,拥有强大的CPU和GPU性能,提供更快的计算和图形处理能力。它还支持5G连接、AI加速、高清摄影和多媒体功能等。如果OPPO推出搭载888处理器的手机,预计它将具备...

...怎么都会出现两种情况,一个是JAV的后缀,一个是JAD的后缀、想问一下...
Java中的jad是jar的描述文件。jad描述了jar的文件大小和位置。打开jad后,根据jad找到jar。jad作用有很多。例如,我可以不下载jar,先下载jad(jad很小),了解一些jar的基本信息后,在决定是否下载jar。jad里还可以存储一些key和value,在midlet运行的时候可能会用到。如果直接用jar运行,就得不到这些key...

急,请问javscript自定义对象的问题?
看你问的东西好乱,都没法回答了。function kk(str){ \/\/像定义类一样,这里放变量,因为是弱类型,放个变量名就行了 this.str = str;this.toString = function(){ return this.str; } } var bb = new kk('sss');bb.toString(); \/\/得到'sss'。

编程需要学什么?
4、JavaScript:JavaScript是一种轻量级的编程语言,它是一个脚本语言,可以嵌入到HTML页面中,由来浏览器来解释执行,用来实现浏览器和用户之间的交互。它的应用场景主要是基于Web的开发。5、Java:是较为传统的面向对象语言,特点是支持跨平台的开发。Jav语言是基于面向对象的思想来设计的 , 但是删去了C+...

网站建设方案
网站建设方案下载 这www.javy.com.cm网站有很多,自己慢慢挑.下面的是其中一篇 网站建设项目计划书的范例 以下内容由广州网络公司www.21thinks.com提供 一、建设网站前的市场分析 1、相关行业的市场是怎样的,市场有什么样的特点,是否能够在互联网上开展公司业务。2、市场主要竞争者分析,竞争对手上网情况...

清远市18984236396: 求好心人帮找或做个JAVA画板程序 代码,主要能实现简单的画板功能! -
枝和舒窗: 取个叫pb.java的文件拷贝进去(pb类为main入口),直接运行 —————————————— 楼主, 不好意思我是学j2ee的,GUI不会,你看我以前的回答一个awt和swing都没有的,这是我们项目组一个牛人的代码,我在我的新系统中嵌入的...

清远市18984236396: 找些有关用JAVA实现的写字板,相当于电子黑板,可以实现一般的书写和画图等功能,有关原代码和实现过程,也可以是其他语言编写的可以集成的. -
枝和舒窗: 写字版有 位置 你的JDK \demo\jfc\Notepad \demo\jfc\Stylepad 画图的木有 里面还有很多好玩的东西 HOHO~~~

清远市18984236396: JAVA做WINDOWS画图板的源程序? -
枝和舒窗: 楼上的代码我做了一点点改正,我想现在可以正常运行了://#8.15//#filename: ShapeMain.java import java.awt.BorderLayout; import java.awt.Button; import java.awt.Color; import java.awt.Container; import java.awt.Graphics; import java.awt.Panel; ...

清远市18984236396: 请问谁有JAVA画图工具的源程序???
枝和舒窗: 他的要求是: &nbsp; &nbsp; &nbsp; 1.要有基本的画图Graphlics &nbsp; &nbsp; &nbsp; &nbsp; 2.有Java2D基本图形对象的绘制 &nbsp; &nbsp; &nbsp; 3.可设制环境,颜色,模式,线型,字体 &nbsp; &nbsp; &nbsp; 4.用到重用类 &nbsp; &nbsp; &nbsp; 5.有数据验证

清远市18984236396: 用java写一个简单的画板画板程序 -
枝和舒窗: 安装jdk之后,其中会有一个demo目录,里面有你需要的例子

清远市18984236396: 求java绘图程序源代码 -
枝和舒窗: import java.awt.*; import java.awt.event.*; import java.util.*; public class MyTestGeneric{ public static void main(String args[]) { new MyFrame99("drawing..."); } } class MyFrame99 extends Frame { ArrayList<Point> points = null; MyFrame99(String ...

清远市18984236396: java小画板程序该怎么做,大部分教程到最后都没舍得给一个几十行代码的小例子 -
枝和舒窗: import java.awt.BorderLayout; //布局管理器的一种,一个面板分东南西北中五个区, 用于放置控间,这样GUI在放大缩小,移植的时候方便 import java.awt.Button; import java.awt.Color; import java.awt.Container;// 一般的 Abstract Window Toolkit...

清远市18984236396: Java 推箱子 源代码 -
枝和舒窗: 界面的各个图片e799bee5baa6e79fa5e98193e58685e5aeb931333365656633,自己做好哦 创建一个窗体 import javax.swing.JFrame; public class GameFrame extends JFrame {//extends继承 GamePanel gp;//构建GameFrame方法 public ...

清远市18984236396: java 实现一个有背景图片的画板,为什么只能画出点来,而且一画按钮就不见了,这是源代码 -
枝和舒窗: 因为每次画线之后,你都重新调用了drawImage把线覆盖掉了,不停地画,不停地覆盖

清远市18984236396: java编写有窗口界面应用程序 求代码 -
枝和舒窗: package image; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.GridLayout; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class PanelRunner ...

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 星空见康网