04748JAVA语言程序设计实践考试复习

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Grandaunt/article/details/83688887

考完试了,复习内容全部作废。
考题是两道题,一个半小时时间特别紧张
在这里插入图片描述
一进考场会发一张纸,上面有考题,怎么保存什么的不重要,因为还得删。考完试之后老师会过来让你运行一遍看一下效果。这时候就是最重要的时候了,你要发挥一小段演讲,现场评分,评完删除项目走人就结束了。
能运行是最重要的
能运行是最重要的
能运行是最重要的
其次是能完美的正确运行。
写的再多最后测试没完成,不能运行一点用都没有,切记切记。
我的感受
1.这个世界没有什么是绝对的,比如考题
2.鼠标巨难用,用的我手抖
重点是
无论复习的怎么样考试题目才是最重要的,考前临时背除非是原题不然就特别不明智的,尽量在考试之前清空一下脑袋迎接试题

至于考题答案,太简单了,我就不再写一遍了。
第一题类似源码:

package KT;

import java.awt.Button;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

//6.Frame的使用,比如设置窗口大小,可见,创建并添加文本与按钮

public class FrameTest {

	public static void main(String[] args) {
		Frame frame = new Frame();
		TextField textField = new TextField();
		Button button = new Button("确定");
		frame.setBounds(300,500,400,500);
		frame.setLayout(new FlowLayout());
		frame.add(button);
		frame.add(textField);
		frame.addWindowListener(new WindowListener() {
			
			@Override
			public void windowOpened(WindowEvent e) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void windowIconified(WindowEvent e) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void windowDeiconified(WindowEvent e) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void windowDeactivated(WindowEvent e) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void windowClosing(WindowEvent e) {
				// TODO Auto-generated method stub
			System.exit(0);
			}
			
			@Override
			public void windowClosed(WindowEvent e) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void windowActivated(WindowEvent e) {
				// TODO Auto-generated method stub
				
			}
		});
		
		button.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				System.out.println(textField.getText());
			}
		});
		frame.setVisible(true);
	}
	
}

                                                 **作废内容**
  1. 考试情况

java语言程序设计实践是在北邮考,北邮有考试指导

文档下载: https://download.csdn.net/download/grandaunt/10762461
据我估计考题应该是补充重点代码型的,至于真实情况,我考完试再来补充分享。

2. 考前复习情况
但是四道小题,一道大题一共一个半小时还是比较紧张,熟练的才好,记得带支笔,听说传闻中有画图的
如果实在不会,就运行看系统提示,或者把鼠标放在错误出,看看会不会弹出建议选择主要看书里例题,然后拿样题试着调试,需要带笔:笔是用来记第二次登录密码的,以备突然死机用去了别听老师讲话,先登录界面,输入该输入的,把该建的文件夹建了,省时间,离开别忘了删掉建立的文件,清空回收站
截图键:Alt+Prtsc

按CTRL+V键即可粘贴。
Eclipse使用问题(安装问题什么的就略过吧~)
经典代码
1.鼠标画椭圆
https://blog.csdn.net/xietansheng/article/details/55669157

2.输出文件目录
package KT;

import java.awt.Button;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.TextArea;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.io.File;

//14.自行设计程序界面,在选定目录后,显示该目录及其子孙目录下的文件信息

public class file {
public static void main(String[] args) {
	new MyDirFile();
}
public static class MyDirFile{
	private Frame frame= new Frame();
	private Button button = new Button("转到");
	private TextField textfield = new TextField(50);
	private TextArea textArea= new TextArea(50,70);
	
	MyDirFile(){
		Init();
	}

	private void Init() {
		// TODO Auto-generated method stub
		frame.setBounds(200, 400, 500, 400);
		frame.setLayout(new FlowLayout());
		frame.add(button);
		frame.add(textfield);
		frame.add(textArea);
		MyEvent();
		frame.setVisible(true);
	}

	private void MyEvent() {
		// TODO Auto-generated method stub
		frame.addWindowListener(new WindowListener() {
			
			@Override
			public void windowOpened(WindowEvent e) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void windowIconified(WindowEvent e) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void windowDeiconified(WindowEvent e) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void windowDeactivated(WindowEvent e) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void windowClosing(WindowEvent e) {
				// TODO Auto-generated method stub
				System.exit(0);
			}
			
			@Override
			public void windowClosed(WindowEvent e) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void windowActivated(WindowEvent e) {
				// TODO Auto-generated method stub
				
			}
		});
		button.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				shouDir();
			}

		});
		textfield.addKeyListener(new KeyListener() {
			
			@Override
			public void keyTyped(KeyEvent e) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void keyReleased(KeyEvent e) {
				// TODO Auto-generated method stub
				if(e.getKeyCode() == e.VK_ENTER) {
					shouDir();	
				}
			}
			
			@Override
			public void keyPressed(KeyEvent e) {
				// TODO Auto-generated method stub
				
			}
		});
		
	}
	private void shouDir() {
		// TODO Auto-generated method stub
		String dir = textfield.getText();
		File file = new File(dir);
		if(file.exists()&&file.isDirectory()) {
			//清空文本区域内容
			textArea.setText("");
			String[] strings = file.list();
			for(String str :strings) {
				textArea.append(str+"\n");
			}
		}
		textfield.setText("");
	}
}
}

3.连接到数据源并输出
package KT;

import java.sql.*;

//9.连接到数据源并输出
public class ODBC {
public static void main(String[] args) throws Exception {
DatabaseConnection databaseConnection = new DatabaseConnection();
}
}
//定义一个数据库连接类

class DatabaseConnection
{

	//创建连接对象
	Connection ct = null;
	//创建用于发生sql语句的对象
	PreparedStatement ps = null;
	//创建用于接受结果集的对象
	ResultSet rs = null;
	//构造函数
	public DatabaseConnection()
	{
		try {
			//加载驱动
			Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
			//得到连接
			ct = DriverManager.getConnection("jdbc:odbc:vote","root","root");
			//进行crud操作
			//增加操作
			ps = ct.prepareStatement("insert into student(Sno,Sname,Ssex) values('1513220146','马云','男')");
			ps.executeUpdate();
			
			//删除操作
			ps = ct.prepareStatement("delete from student where Sname = '马云'");
			ps.executeUpdate();
			
			//修改操作
			ps = ct.prepareStatement("update student set Sname = '岳云鹏' where Sname = '鹿晗'");
			ps.executeUpdate();
			
			//查询操作
			ps = ct.prepareStatement("select * from student");
			//将结果输入到结果集中
			rs = ps.executeQuery();
			//循环输出
			while(rs.next())
			{
				String a = rs.getString(2);
				String b = rs.getString(3);
				//输出结果
				System.out.println(a + " " + b);
			}
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}finally
		{
			try {
				//关闭资源
				if(rs != null)
				{
					rs.close();
				}
				if(ps != null)
				{
					ps.close();
				}
				if(ct != null)
				{
					ct.close();
				}
				
			} catch (Exception e2) {
				// TODO: handle exception
				e2.printStackTrace();
			}
			
			
		}
	}
}

线程控制Thread sleep

package KT;

import java.util.Scanner;

//1.线程控制Thread  sleep的使用
public class Thread1 {
	 public static void main(String args[]){ 
		 Thread t=new Thread(new Ss());
		 t.start();
		 try { 
			 Thread.sleep(2000); 
		 }
		 catch (InterruptedException e) { 
			 // TODO Auto-generated catch block 
			 e.printStackTrace(); 
			 } System.out.println("I am main!"); 
			 } 
	 
public static class Ss implements Runnable{ 
		 public void run(){
			 System.out.println(Thread.currentThread());
			 } 
		
} 

 }

实践指导考题答案(题目详情见考试指导):
样题一:
一、纠正程序“c1.java”的语法错误,然后回答问题(25分)

(1)纠正程序中的语法错误。
答:
(2)程序的功能是什么?如果向程序中输入数据7,程序运行的结果是什么?请把程序运行结果的贴图存储到ans.doc中。
答:
二、程序中有若干空白,请完善程序题目,并回答问题(40分)
(1)程序A21的功能是判断2~N之间哪些整数是质数(n从键盘输入)。请完善程序,并把程序运行结果的贴图存储到ans.doc中。
答:

 cc=JOptionPane.ShowInputDialog(‘请输入一个二位整数:‘);改成 cc=JOptionPane.showInputDialog("请输入一个二位整数:");
      n=Integer.ParseInt(cc);改成     n=Integer.parseInt(cc);
           System.out.println(‘运算结果是:’+ee);改成
       double jiech(int x){加static 变成 static double jiech(int x){

(2)程序A22的功能是单击按钮【求平方】,就能够输出文本框中输入数据的平方,请把程序补充完整,并把程序运行结果的贴图存储到ans.doc中。
答: public Button btn = new Button(“求平方”);
三:程序设计(35分)
编写数组处理程序a3.java。要求定义整型数组,并从键盘上输入10个数据,然后求出其中的最大者和所有数据的总和。
答:
样题二
一、纠正程序“c1.java”的语法错误,然后回答问题(25分)

(1)纠正程序中的语法错误。
答:
(2)程序的功能是什么?如果向程序中输入数据153,程序运行的结果是什么?向程序中输入数据128,程序的运行结果是什么?,并把程序运行结果的贴图存储到ans.doc中。
二、程序中有若干空白,请完善程序题目,并回答问题(40分)
(1)程序b21的功能是判定某一年是否闰年。请完善程序,并把程序运行结果的贴图存储到ans.doc中。
答:
(2)程序b22的功能是在监控台上每隔一秒钟显示一个字符串“Hello!”,请填空把程序补充完整,并把程序运行结果的贴图存储到ans.doc中。
答:
三:程序设计(35分)
已知:系统中有ODBC数据源xytest,其中有数据表xsb,结构为:学号,姓名,性别,生日,单位。
请编写程序b3.java,使之能够连接数据源xytest,并输出数据表xsb的所有内容。
答:
样题三:
一、纠正程序“c1.java”的语法错误,然后回答问题(25分)

(1)纠正程序中的语法错误。
答:
(2)程序的功能是什么?如果向程序中输入数据100,程序运行的结果是什么?向程序中输入数据300,程序的运行结果是什么?并把程序运行结果的贴图存储到ans.doc中。
答:
二、程序中有若干空白,请完善程序题目,并回答问题(40分)
(1)程序C21.java的目的是进行复数运算。现在需要计算复数(3+5.8i)和复数(17-6.5i)的和、差、积,请把程序补充完整(程序中所需的数据不需要键盘输入),并把程序运行结果的贴图存储到ans.doc中。
答:
(2)程序C22的功能是:输入一个姓名,程序运行后,输出“姓名Welcome you!”.例如,输入“张三Welcome you !”。请在下面横线处填入正确的方法名,使程序可以正确运行,并把程序运行结果的贴图存储到ans.doc中。
答:
三:程序设计(35分)
设计一个加法器程序c3.java。要求在窗口中有三个文本框和两个按钮。第一个按钮上的文字为“加法”,第二个按钮上的文字为“关闭”。当单击按钮“加法”时,能够把前两个文本框中的数据相加并存放在第三个文本框中。单击按钮“关闭”,则程序结束。
答:
参考资料:
第一道大题:
主要考画图:
学会这个文件夹当中的文件就差不多了。但考试只要求用一个文件。

知识点参考:
P127,第六章 6.6鼠标事件
P140,第七章 7.2绘图

第二道大题参考:
主要考运算:
在这里插入图片描述在这里插入图片描述
在这里插入图片描述
知识点参考:
P76,第四章 (9)、(10)、(11)
P104-105,例5.9

1.线程控制Thread sleep的使用

2.按钮动作的使用

3.ActionListener 和ActionPerformed

4.尤其是大小写是JAVA爱考的

5.简单的类和函数的调用关系

6.Frame的使用,比如设置窗口大小,可见,创建并添加文本与按钮

7.文本用SetText GetText

8.还有字符串与double float int 的转换

9.连接到数据源并输出

这个虽然没考,但是在范围内:

10.链接到数据库,读取并输出已在数据库的表信息

package KT;

/*鼠标画椭圆/
import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FileDialog;
import java.awt.FlowLayout;
import java.awt.Graphics2D;
import java.awt.GridLayout;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.imageio.ImageIO;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JColorChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRootPane;
import javax.swing.JSeparator;
import javax.swing.JToggleButton;
import javax.swing.JToolBar;
import javax.swing.SwingConstants;

import com.ljheee.paint.component.DrawPanel;
import com.ljheee.paint.shape.AirBrush;
import com.ljheee.paint.shape.Curve;
import com.ljheee.paint.shape.DottedRectangle;
import com.ljheee.paint.shape.Eraser;
import com.ljheee.paint.shape.Line;
import com.ljheee.paint.shape.MyPolygon;
import com.ljheee.paint.shape.Oval;
import com.ljheee.paint.shape.Pencil;

import com.ljheee.paint.shape.RoundRect;
import com.ljheee.paint.shape.Shape;
import com.ljheee.paint.shape.ShapeList;
import com.ljheee.paint.shape.Word;
import com.ljheee.paint.ui.about.About;
import com.ljheee.paint.shape.Rectangle;
import javafx.scene.shape.CubicCurve;

//13.编写一个GUI程序,程序允许用户在窗体上执行按下鼠标、拖动鼠标和松开鼠标的动作,在动作结束时,程序以适当的顶点坐标、长度和宽度绘制一个椭圆。
public class GUI extends JFrame{
	private DrawPanel drawPanel = null;//�м�Ļ���
	Graphics2D g = null;
	int x0=0,y0=0,xEnd=0,yEnd=0;
	int xPX = 0,yPX = 0;
	String commandTool = "pencil";//ѡ��ġ�����ָ�
	Color commandColor = Color.black;//��ǰ��ɫ
	Shape shape = null;//��ǰ����[����]��ͼ��
	ShapeList shapelist = new ShapeList();
Curve  curve = null;//����
MyPolygon myPolygon = null;//�����
	int step = 0;
	int curveX0,curveY0,curveXEnd,curveYEnd;
	int cx1,cy1,cx2,cy2;
	private JLabel leftInfo = new JLabel("״̬��:");
	private JLabel pathInfo = new JLabel("  ");
	private JLabel timeInfo = new JLabel("  ");
	public GUI() {
		super("PaintingTool");
		this.setSize(900, 700);
		this.setDefaultCloseOperation(EXIT_ON_CLOSE);
		this.setLocationRelativeTo(null);
		g = (Graphics2D) this.getGraphics();

		JPanel topJPanel = new JPanel();
		topJPanel.setLayout(new GridLayout(2, 1));

		
		JRootPane rootPane = new JRootPane();
		rootPane.setBackground(Color.gray);
		// center--drawingPanel
		drawPanel = new DrawPanel(shapelist);

		drawPanel.addMouseListener(new MouseListenerImpl());
		drawPanel.addMouseMotionListener(new MouseMotionImpl());
    	this.add(drawPanel);
    	this.setVisible(true);
	}
	class MouseListenerImpl implements MouseListener{

		@Override
		public void mouseClicked(MouseEvent arg0) {
			// TODO Auto-generated method stub
			
		}

		@Override
		public void mouseEntered(MouseEvent arg0) {
			// TODO Auto-generated method stub
			
		}

		@Override
		public void mouseExited(MouseEvent arg0) {
			// TODO Auto-generated method stub
			
		}

		@Override
		public void mousePressed(MouseEvent arg0) {
			// TODO Auto-generated method stub
			x0 = arg0.getX();
			y0 = arg0.getY();
			
			g = (Graphics2D)drawPanel.getGraphics();
			
			if(commandTool.equals("word")){//����
				String input;
				input = JOptionPane.showInputDialog("Please input the text you want!");
				Word word = new Word(x0, y0, xEnd, yEnd, commandColor);
				word.text = input;
				shape = word;
				shape.draw(g);
				repaint();
				shapelist.addShape(shape);
			}
			
			if(commandTool.equals("curve")){//����

				if(step == 0||step == -1||curve==null){
					step = 1;//�����һ��������ֱ��
					curveX0 = arg0.getX();
					curveY0 = arg0.getY();
				} 
			}
		}


//		假设鼠标一直停留在A点,往下按然后放开,此时触发的是 mouseClicked 事件
//		鼠标被按下,一直不松手,不论停留在原处还是移动,此时触发的是 mousePressed 事件
//		mouseReleased  最复杂,因为它必须发生在 mousePressed 和 mouseDragged 之后:
//
//		假设鼠标在A点被按下,然后一直不松开,然后移动到 B 点, 松开,此时触发的是 mouseReleased 事件,在 mouseReleased  事件之前,一定会有 mousePressed 和mouseDragged 事件
//	
		@Override
		public void mouseReleased(MouseEvent e) {
			xEnd = e.getX();
			yEnd = e.getY();
			
			g = (Graphics2D)drawPanel.getGraphics();

			if(commandTool.equals("air_brush")){//����Ͱ
				AirBrush airBrush = new AirBrush(x0, y0, xEnd, yEnd, commandColor);
				shape = airBrush;
				airBrush.flag = 1;
				shape.draw(g);
				repaint();
				shapelist.addShape(shape);
				return;
			}
			
			
			if(commandTool.equals("polygon")){//�����
				if(myPolygon == null){
					myPolygon = new MyPolygon(x0, y0, xEnd, yEnd, commandColor);
				}
				
				myPolygon.npoints++;
				myPolygon.xpoints[myPolygon.npoints-1] = xEnd;
				myPolygon.ypoints[myPolygon.npoints-1] = yEnd;
				
				shape = myPolygon;
			}
			
			
			
			if(commandTool.equals("curve")){//����
				
				if(step == 1){
					curveXEnd = e.getX();
					curveYEnd = e.getY();
					step = 2;//��һ������ͷţ�ֱ����ɡ��ڶ�����ȷ��ctrlPoint1
					return;
				} else if(step == 2){
					cx1 = e.getX();
					cy1 = e.getY();
//					curve.cubicCurve2D.ctrlx1 = e.getX();
//					curve.cubicCurve2D.ctrly1 = e.getY();
					step = 3;//��������ȷ��ctrlPoint2
					return;
				} else if(step == 3){
//					curve.cubicCurve2D.ctrlx2 = e.getX();
//					curve.cubicCurve2D.ctrly2 = e.getY();
					cx2 = e.getX();
					cy2 = e.getY();
					curve.cubicCurve2D.setCurve(curveX0, curveY0, cx1, cy1, cx2, cy2, curveXEnd, curveYEnd);
					shape.draw(g);
					repaint();
					shapelist.addShape(shape);
					step = -1;
					curve = null;
					return;
				}
				
				
			}
			
			
			switch (commandTool) {
			case "line":	//ֱ直线  
	 	 		shape.draw(g);
//	 	 		repaint();
	 	 		shapelist.addShape(shape);
				break;
			
			case "rect"://方块	   
				shape.draw(g);
				repaint();
				shapelist.addShape(shape);
				break;
				
			case "round_rect":	//圆角方块   
				shape.draw(g);
				repaint();
				shapelist.addShape(shape);
				break;
			case "dot_rect"://虚线方块	   
				shape.draw(g);
				repaint();
				shapelist.addShape(shape);
				break;
			case "oval":	//椭圆   
				shape.draw(g);
				repaint();
				shapelist.addShape(shape);
				break;
			case "pencil":	//铅笔   
				shape.draw(g);
				repaint();
				shapelist.addShape(shape);
				break;
				
//			case "polygon":	   
//				shape.draw(g);
//				repaint();
//				shapelist.addShape(shape);
//				break;
				
			}
		}
	}
	
	/**
	 * ����϶�
	 * @author ljheee
	 *
	 */
	class MouseMotionImpl implements MouseMotionListener{

		@Override
		public void mouseDragged(MouseEvent e) {
			
			xEnd = e.getX();
			yEnd = e.getY();
			
			g = (Graphics2D)drawPanel.getGraphics();
			
			//Ǧ�ʻ���Ƥ��
			if(commandTool.equals("pencil")||commandTool.equals("eraser")){
				xEnd = e.getX();
				yEnd = e.getY();
				shape = new Pencil(x0, y0, xEnd, yEnd, commandColor);
				if(commandTool.equals("eraser")){
					shape = new Eraser(x0, y0, xEnd, yEnd, Color.white);
				}
				shape.draw(g);
				repaint();
				shapelist.addShape(shape);
				
				//��������
				x0 = xEnd;
				y0 = yEnd;
			}
			
			
				
			switch (commandTool) {
				
			case "line":	//ֱ直线
				shape = new Line(x0, y0, xEnd, yEnd, commandColor);
				shape.draw(g);
				repaint();
				break;
			
			case "rect":	//方块
				shape = new Rectangle(x0, y0, xEnd, yEnd, commandColor);
				shape.draw(g);
				repaint();
				break;
				
			case "round_rect":	//圆角方块
				shape = new RoundRect(x0, y0, xEnd, yEnd, commandColor);
				shape.draw(g);
				repaint();
				break;
			case "dot_rect":	//��߾���   
				shape = new DottedRectangle(x0, y0, xEnd, yEnd, commandColor);
				shape.draw(g);
				repaint();
				break;
				
			case "oval":	//椭圆   
				shape = new Oval(x0, y0, xEnd, yEnd, commandColor);
				shape.draw(g);
				repaint();
				break;
//			case "curve":	//曲线
//				if(step == 1&&curve==null){
//					curve = new Curve(curveX0, curveY0, xEnd, yEnd, commandColor);
//					curve.cubicCurve2D.setCurve(curveX0, curveY0, curveX0, curveY0, xEnd, yEnd, xEnd, yEnd);
//					curve.draw(g);
//				} else if(step == 2){
//					curve.cubicCurve2D.setCurve(curveX0, curveY0, xEnd, yEnd, xEnd, yEnd, curveXEnd, curveYEnd);
//				} else if(step == 3){
//					curve.cubicCurve2D.setCurve(curveX0, curveY0, cx1, cy1, xEnd, yEnd, curveXEnd, curveYEnd);
//				}
//				
//				shape = curve;	
//				shape.draw(g);
//				repaint();
//				break;
				
				
			default:
				break;
			}
			
			
			
			
			xPX = e.getX();
			yPX = e.getY();
			pathInfo.setText("  "+xPX+","+yPX);//״̬����ʾ�����������Ϣ��
		}

		@Override
		public void mouseMoved(MouseEvent e) {
			xPX = e.getX();
			yPX = e.getY();
			pathInfo.setText("  "+xPX+","+yPX);//״̬����ʾ�����������Ϣ��
		}
	}
	

	public static void main(String[] args) {
		new GUI();
	}

}

猜你喜欢

转载自blog.csdn.net/Grandaunt/article/details/83688887