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

📄 example7_28.java.bak

📁 不错的教程 适合中高级人员的使用
💻 BAK
字号:
import java.applet.*;import java.awt.*; 
import java.awt.event.*;
 class Windowmouse extends Frame implements MouseListener
{  TextField text;
   Button button;
   TextArea textArea;
   Windowmouse()
   {   setLayout(new FlowLayout());
	   text=new TextField(10); add(text);
	   text.addMouseListener(this);
      addMouseListener(this) ;//向小程序增加鼠标事件监视器。
	  addWindowListener(new WindowAdapter()
	      { public void windowClosing(WindowEvent e)
	        {System.exit(0);}
	      }
	  );
	  button=new Button("按钮");
	  button.addMouseListener(this);
	  add(button);	  
	  textArea=new TextArea(5,28);

	   setBounds(100,100,220,120);
         setVisible(true);
         validate();
   }   
   public void mousePressed(MouseEvent e)
   {  textArea.setText("鼠标键按下了,位置是"+e.getX()+","+e.getY() );
   } 
   public void mouseReleased(MouseEvent e)
   {  textArea.setText(" 鼠标松开了,位置是"+e.getX()+","+e.getY() );
   }
   public void mouseEntered(MouseEvent e)
   {  textArea.setText(" 鼠标进来了,位置是"+e.getX()+","+e.getY() );
   }
   public void mouseExited(MouseEvent e)
   {  textArea.setText(" 鼠标走开了");
   }
   public void mouseClicked(MouseEvent e)
   {  if(e.getClickCount()==2)
       {  textArea.setText("鼠标键双击,位置:"+e.getX()+","+e.getY());
       }  
      else {}
   }
}
public class Example7_28
{
	public static void main(String args[])
	{
		new Windowmouse();
	}
}

⌨️ 快捷键说明

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