java 标签没显示出来
程序运行界面源代码如下:importjava.awt.*;importjava.awt.event.*;importjavax.swing.JFrame;publiccl...
程序运行界面 源代码如下:
import java.awt.*;
import java.awt.event.*;
import javax.swing.JFrame;
public class UseMultiEvent extends JFrame implements MouseListener,MouseMotionListener{
/**
* @param args
*/
TextField t=new TextField(20);
public UseMultiEvent(){
Frame f=new Frame("Welcome to java world!");
Label l=new Label("I am xiaoma");
f.add(l,"SOUTH");
f.add(t,"NORTH");
f.addMouseListener(this);
f.addMouseMotionListener(this);
f.setVisible(true);
}
public static void main(String[] args) {
UseMultiEvent u=new UseMultiEvent();
}
public void mouseDragged(MouseEvent e){
String s=("鼠标移动到:"+e.getX()+","+e.getY());
t.setText(s);
}
public void mouseEntered(MouseEvent e){
t.setText("您已进入程序");
}
public void mouseClicked(MouseEvent e){t.setText("TNND");}
public void mouseMoved(MouseEvent e){t.setText("abc");}
public void mousePressed(MouseEvent e){t.setText("cde");}
public void mouseReleased(MouseEvent e){t.setText("def");}
public void mouseExited(MouseEvent e){t.setText("efg");}
}
请讲详细 我是小白 谢谢 展开
import java.awt.*;
import java.awt.event.*;
import javax.swing.JFrame;
public class UseMultiEvent extends JFrame implements MouseListener,MouseMotionListener{
/**
* @param args
*/
TextField t=new TextField(20);
public UseMultiEvent(){
Frame f=new Frame("Welcome to java world!");
Label l=new Label("I am xiaoma");
f.add(l,"SOUTH");
f.add(t,"NORTH");
f.addMouseListener(this);
f.addMouseMotionListener(this);
f.setVisible(true);
}
public static void main(String[] args) {
UseMultiEvent u=new UseMultiEvent();
}
public void mouseDragged(MouseEvent e){
String s=("鼠标移动到:"+e.getX()+","+e.getY());
t.setText(s);
}
public void mouseEntered(MouseEvent e){
t.setText("您已进入程序");
}
public void mouseClicked(MouseEvent e){t.setText("TNND");}
public void mouseMoved(MouseEvent e){t.setText("abc");}
public void mousePressed(MouseEvent e){t.setText("cde");}
public void mouseReleased(MouseEvent e){t.setText("def");}
public void mouseExited(MouseEvent e){t.setText("efg");}
}
请讲详细 我是小白 谢谢 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询