请详细的帮我解释下这个java程序!
importjava.awt.*;importjava.awt.event.*;publicclassHJextendsFrameimplementsMouseMotio...
import java.awt.*;
import java.awt.event.*;
public class HJ extends Frame implements MouseMotionListener
{
static HJ frm=new HJ();
static WinLis wlis=new WinLis();
public HJ()
{
}
public static void main(String args[])
{
frm.setBackground(Color.orange);
frm.setLayout(null);
frm.addMouseMotionListener(frm);//添加鼠标事件
frm.setSize(200, 150);//设置初始大小
frm.addWindowListener(wlis);//添加窗体事件
frm.setVisible(true);
}
public void mouseMoved(MouseEvent e)
{
frm.setTitle("x="+e.getX()+"y="+e.getY());
}
static class WinLis extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{
frm.dispose();//当按下关闭按纽的时候关闭窗体
}
}
}
各位大虾,谢谢了,我下午要呢! 展开
import java.awt.event.*;
public class HJ extends Frame implements MouseMotionListener
{
static HJ frm=new HJ();
static WinLis wlis=new WinLis();
public HJ()
{
}
public static void main(String args[])
{
frm.setBackground(Color.orange);
frm.setLayout(null);
frm.addMouseMotionListener(frm);//添加鼠标事件
frm.setSize(200, 150);//设置初始大小
frm.addWindowListener(wlis);//添加窗体事件
frm.setVisible(true);
}
public void mouseMoved(MouseEvent e)
{
frm.setTitle("x="+e.getX()+"y="+e.getY());
}
static class WinLis extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{
frm.dispose();//当按下关闭按纽的时候关闭窗体
}
}
}
各位大虾,谢谢了,我下午要呢! 展开
2个回答
展开全部
import java.awt.*;
import java.awt.event.*;
public class HJ extends Frame implements MouseMotionListener {
private static final long serialVersionUID = 1L;
static HJ frm = new HJ();
static WinLis wlis = new WinLis();
public HJ() {//构造函数
}
public static void main(String args[]) {
frm.setBackground(Color.orange);//设置背景色为橙色
frm.setLayout(null);//这句话没用
frm.addMouseMotionListener(frm);// 添加鼠标事件
frm.setSize(200, 150);// 设置初始大小
frm.addWindowListener(wlis);// 添加窗体事件
frm.setVisible(true);//窗体可见
}
public void mouseMoved(MouseEvent e) {
frm.setTitle("x=" + e.getX() + "y=" + e.getY()); //设置标题
}
static class WinLis extends WindowAdapter {
public void windowClosing(WindowEvent e) {
frm.dispose();// 当按下关闭按纽的时候关闭窗体
}
}
public void mouseDragged(MouseEvent e) {
// TODO Auto-generated method stub
}
}
import java.awt.event.*;
public class HJ extends Frame implements MouseMotionListener {
private static final long serialVersionUID = 1L;
static HJ frm = new HJ();
static WinLis wlis = new WinLis();
public HJ() {//构造函数
}
public static void main(String args[]) {
frm.setBackground(Color.orange);//设置背景色为橙色
frm.setLayout(null);//这句话没用
frm.addMouseMotionListener(frm);// 添加鼠标事件
frm.setSize(200, 150);// 设置初始大小
frm.addWindowListener(wlis);// 添加窗体事件
frm.setVisible(true);//窗体可见
}
public void mouseMoved(MouseEvent e) {
frm.setTitle("x=" + e.getX() + "y=" + e.getY()); //设置标题
}
static class WinLis extends WindowAdapter {
public void windowClosing(WindowEvent e) {
frm.dispose();// 当按下关闭按纽的时候关闭窗体
}
}
public void mouseDragged(MouseEvent e) {
// TODO Auto-generated method stub
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询