⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testanonymous.java

📁 java中awt应用的例子
💻 JAVA
字号:
import java.awt.*;
import java.awt.event.*;

public class TestAnonymous implements ActionListener{
	Frame f;
	TextArea tf;
	Button bt;
	int number=1;
   
	public TestAnonymous(){
		Label label=new Label("click and Drag the mouse");
		f=new Frame("Test Inner class");
		tf=new TextArea();
    	bt = new Button("退出");
	    
	  	tf.addMouseMotionListener(new MouseMotionAdapter(){
	  		 public void mouseDragged(MouseEvent e){ 
				String s = number+++" "+"The mouse Dragged: x= "+
							e.getX()+" y="+e.getY()+"\n";
				tf.append(s);
			 }
		 });   
	    bt.addActionListener(this);
	    
	    f.add(label,BorderLayout.NORTH);
	    f.add(tf,BorderLayout.CENTER);
	    f.add(bt,BorderLayout.SOUTH);		
		f.setSize(300,200);
		f.setVisible(true);
	}

    public void actionPerformed(ActionEvent e){
		System.exit(0);
	}

	public static void main(String args[]){
		TestAnonymous two = new TestAnonymous( );
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -