import java.awt.*;
import java.awt.event.*;public class MyApp333 extends Frame
{
public MyApp333()
{
this.addWindowListener (new WindowAdapter(){
public void windowClosing(WindowEvent e){
dispose();
System.exit(0);
}
});
}
public static void main(String args[])
{
System.out.println("Starting App");
MyApp333 f = new MyApp333();
f.setSize(100,100);
f.show();
}
}
import java.awt.event.*;public class MyApp333 extends Frame
{
public MyApp333()
{
this.addWindowListener (new WindowAdapter(){
public void windowClosing(WindowEvent e){
dispose();
System.exit(0);
}
});
}
public static void main(String args[])
{
System.out.println("Starting App");
MyApp333 f = new MyApp333();
f.setSize(100,100);
f.show();
}
}
解决方案 »
- 子类主动使用却没有被初始化
- struts1.2有没有和json交互的包.
- 关于JTable单元格文字换行~
- 关于延时显示的问题
- BigObjectThatShouldNotBeSerializedWithAButton bigOne;是什么意思阿?java高手请帮我回答
- 菜鸟提问:如何用数组构成链表实现数三退一
- 如何用java调用OUTLOOK写一个邮件,不要每调用一次就打开一个OUTLOOK 高分求助!!
- 代码疑问
- 学习JAVA
- java题目
- i have a string="<html><body><p>haha</p>.......",how can i biuld it into a HTMLDocument
- 请问GBK、GB2312、iso-8859-1之间的区别?哪里有这方面的资料?
import java.awt.event.*;public class TwoListenInner
{
private Frame f;
private TextField tf;
public static void main(String args[]){
TwoListenInner That=new TwoListenInner();
}
public TwoListenInner(){
f=new Frame("Two listeners example");
f.add("North",new Label("Click and drag the mouse"));
tf=new TextField(30);
f.add("South",tf);
f.addMouseMotionListener(new MouseMotionHandler());
f.addMouseListener(new MouseEventHandler());
f.setSize(300,300);
f.setEnabled(true);
f.setVisible(true);
}
public class MouseMotionHandler extends MouseMotionAdapter{
public void mouseDragged(MouseEvent e){
String s="Mouse dragging: X="+e.getX()+"Y="+e.get();
tf.setText(s);
}
}
public class MouseEventHandler extends MouseAdapter{
public void mouseEntered(MouseEvent e){
String s="The mouse entered";
tf.setText(s);
}
public void mouseExited(MouseEvent e){
String s="The mouse has left the building";
tf.setText(s);
}
}
}
import java.awt.*;
import java.awt.event.*;public class TwoListenInner
{
private Frame f;
private TextField tf;
public static void main(String args[]){
TwoListenInner That=new TwoListenInner();
}public TwoListenInner(){f=new Frame("Two listeners example");
f.add("North",new Label("Click and drag the mouse"));
f.addWindowListener (new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});tf=new TextField(30);
f.add("South",tf);
f.addMouseMotionListener(new MouseMotionHandler());
f.addMouseListener(new MouseEventHandler());
f.setSize(300,300);
f.setEnabled(true);
f.setVisible(true);
}
public class MouseMotionHandler extends MouseMotionAdapter{
public void mouseDragged(MouseEvent e){
String s="Mouse dragging: X="+e.getX()+"Y="+e.getY();
tf.setText(s);
}
}public class MouseEventHandler extends MouseAdapter{
public void mouseEntered(MouseEvent e){
String s="The mouse entered";
tf.setText(s);
}
public void mouseExited(MouseEvent e){
String s="The mouse has left the building";
tf.setText(s);
}
}
}