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

📄 demo.java

📁 BufferedReader主要实现的功能是: 数据的缓冲。外加一个按扭游戏。 所用的语言:Java.
💻 JAVA
字号:
import java.awt.*;
import java.awt.event.*;

class Mywin extends Frame{
	Label lab_name=null;
	TextField source=null,
		      target=null;
	Label lab_sex=null;
	Checkbox ch1=null,
			 ch2=null;
	Button b1=null,
		   b2=null;
	CheckboxGroup cbg=null;
	Panel p1=null,
		  p2=null,
	      p3=null;
	
	Mywin(String title){
		super(title);
		init();
	}
	
	void init(){
		lab_name=new Label("source");
		source=new TextField(20);
		
		lab_sex=new Label("target");
		target=new TextField(20);
		target.setEnabled(false);
		
		b1=new Button("copy");
		b2=new Button("clear");
		p1=new Panel();
		p2=new Panel();
		
		
		p1.add(lab_name);
		p1.add(source);
		p1.add(lab_sex);
		p1.add(target);
		p2.add(b1);
		p2.add(b2);
		
		this.add(p1,BorderLayout.NORTH);
		this.add(p2,BorderLayout.CENTER);
		
		b1.addActionListener(new ButtonHandler());
		b2.addActionListener(new ButtonHandler());
	
		this.addWindowListener(new MywinHandler());
	
	}

	class ButtonHandler implements ActionListener{
		
		public void actionPerformed(ActionEvent e){
			if(e.getSource()==b1){
				target.setText(source.getText());
					
			}
			if(e.getSource()==b2){
				target.setText(null);
				source.setText(null);	
			}
			
			
		}
	}
	
	class MywinHandler implements WindowListener{
		public void windowActivated(WindowEvent e){}
		public void windowDeactivated(WindowEvent e){}
		public void windowDeiconified(WindowEvent e){}
		public void windowIconified(WindowEvent e){}
		public void windowClosed(WindowEvent e){}
		public void windowClosing(WindowEvent e){
			System.exit(0);	
		}
		public void windowOpened(WindowEvent e){}
		
	}

	public static void main(String args[]){
		Frame f=new Mywin("my first windows");
		f.setSize(600,300);
		f.setVisible(true);
	}
}

⌨️ 快捷键说明

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