<html>
<head>
<body>
<table width="600" height="400" cellpadding="0" cellspacing="0" border="1" bordercolordark="#000000" id="table" style="font-size:16px; color: #000000;font-weight:bold;" >
<script>
function GetALine( )
{
var fso, f, s;
s = "";
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.OpenTextFile('d:\\info.txt', 1, false);
var ss=[]
while (!f.AtEndOfStream){
ms= f.ReadLine( ).match(/name:([^|]+)\|phone:(.+)/);
document.write(
'<tr><td >',ms[1] ,'</td><td width="259" >',ms[2],'</td></tr>'
);
}
f.Close( );
}
GetALine();
</script>
</table>
</head>
</html>
用java编写一个画图软件
package s;//包名
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Test extends JFrame {
int x1,y1,x2,y2;public Test(){
setVisible(true);
setSize(300,300) ;
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e){
System.exit(0) ; }});
addMouseListener(
new MouseAdapter() {
public void mousePressed(MouseEvent e){
x1=e.getX();
y1=e.getY();} });
addMouseMotionListener(new MouseMotionAdapter() {
public void mouseDragged(MouseEvent e){
x2=e.getX() ;
y2=e.getY() ;
repaint(); }});
}
public void paint(Graphics g)
{
g.drawLine(x1,y1,x2,y2);
x1=x2;
y1=y2;
}
public static void main(String args[])
{
new Test();
}
}
java开发画图板用什么软件
你的问题问的有点纠结:
如果你问的是工具,建议:Eclipse
如果你问的是语言,那就是你说的Java Swing
用java编写画图工具
要求比较多阿 给你个简单的供参考
import java.awt.*;
import java.awt.event.*;
class Mycanvas extends Canvas
{ int x,y,r;
Mycanvas()
{ setBackground(Color.cyan);
}
public void setX(int x)
{ this.x=x;
}
public void setY(int y)
{ this.y=y;
}
public void setR(int r)
{ this.r=r;
}
public void paint(Graphics g)
{ g.drawOval(x,y,2*r,2*r); //通过Graphics对象画圆
}
}
class WindowCanvas extends Frame implements ActionListener
{ Mycanvas canvas;
TextField inputR,inputX,inputY;
Button b;
WindowCanvas()
{ canvas=new Mycanvas();//创建画布对象
inputR=new TextField(5);
inputX=new TextField(4);
inputY=new TextField(4);
Panel pNorth=new Panel(), pSouth=new Panel();//创建两个面板
pNorth.add(new Label("圆的位置坐标:"));
pNorth.add(inputX);
pNorth.add(inputY);
pSouth.add(new Label("圆的半径:"));
pSouth.add(inputR);
b=new Button("确定");
b.addActionListener(this);
pSouth.add(b);
add(canvas,BorderLayout.CENTER); //添加画布对象到中央区域
add(pNorth,BorderLayout.NORTH);
add(pSouth,BorderLayout.SOUTH);
setBounds(100,100,300,200);
setVisible(true);
}
public void actionPerformed(ActionEvent e)
{ int x,y,r;
try { x=Integer.parseInt(inputX.getText());
y=Integer.parseInt(inputY.getText());
r=Integer.parseInt(inputR.getText());
canvas.setX(x); //设置自定义画布对象的实例变量x
canvas.setY(y);//设置自定义画布对象的实例变量y
canvas.setR(r);//设置自定义画布对象的实例变量r
canvas.repaint();//重画自定义画布对象
}
catch(NumberFormatException ee)
{ x=0;y=0;r=0;
}
}
}
public class Example18
{ public static void main(String args[])
{ new WindowCanvas();
}
}
Java 画图软件中如何保存画布中的图像?
BufferedImage img = new BufferedImage(int w, int h)
[Component].printAll(img.getGraphics());
ImageIO.write(img,[OutputStream out]);
想要一个用java的eclipse软件开发的画图软件的代码、急需的。财富值少了点。但也希望有人能帮帮忙、
当年的作业,比较简单的小程序
import java.awt.*;
import java.awt.event.*;
import javax. swing.*;
class Graphic implements ActionListener
{ JFrame f;
JMenuBar myMenuBar;
JMenu menuDraw,menuHelp;
JMenuItem itemCircle,itemRect,itemLine;
int x,y,lastX=0,lastY=0,drawType;
public void display()
{ f = new JFrame("带有菜单的窗口");
f.setSize(300,300); f.setLocation(300,300);
f.setBackground(Color.lightGray);
myMenuBar=new JMenuBar();
menuDraw=new JMenu("画图");
menuHelp=new JMenu("帮助");
myMenuBar.add(menuDraw); myMenuBar.add(menuHelp);
itemCircle=new JMenuItem("画圆");
itemRect=new JMenuItem("画矩形");
itemLine=new JMenuItem("画线");
menuDraw.add(itemLine);
menuDraw.add(itemCircle);
menuDraw.add(itemRect);
f.setJMenuBar(myMenuBar);
f.setVisible(true);
itemCircle.addActionListener(this);
itemRect.addActionListener(this);
itemLine.addActionListener(this);
f.addMouseListener(new MouseAdapter(){
public void mousePressed(MouseEvent e){
lastX=e.getX();
lastY=e.getY();
}
});
f.addMouseMotionListener(new MouseMotionAdapter(){
public void mouseDragged(MouseEvent e){
x=e.getX();
y=e.getY();
Graphics g=f.getGraphics();
if(drawType==1)
{
g.clearRect(0,50,300,300);
g.drawOval(lastX,lastY,x-lastX,y-lastY);
}
else if(drawType==2)
{
g.clearRect(0,50,300,300);
g.drawRect(lastX,lastY,x-lastX,y-lastY);
}
else if(drawType==3)
{
g.clearRect(0,50,300,300);
g.drawLine(lastX,lastY,x,y);
}
}
});
}
public void actionPerformed(ActionEvent e)
{ if(e.getActionCommand()=="画圆")
drawType=1;
else if(e.getActionCommand()=="画矩形")
drawType=2;
else if(e.getActionCommand()=="画线")
drawType=3;
}
public static void main(String arg[])
{ (new Graphic()).display(); }
}
最近我要用android来开发一个绘图软件,请问android里有像java里,C里那么强大的数学函数库可以调用吗?
有数学库给你用,是.jar包
http://commons.apache.org/proper/commons-math/download_math.cgi
哦,这个jar包强大吗?
commons-math3-3.0-bin.jar,可以用来计算Gama,Beta函数值,完成积分,微分运算,回归聚类,多项式拟合等
转载请注明出处51数据库 » java中画图软件 JAVA绘图软件
T当我的秀发拂过你的钢枪