simplepanel.java

来自「接着上次传入一些Java学习中的实验」· Java 代码 · 共 57 行

JAVA
57
字号
import java.awt.*;
public class SimplePanel extends Thread {
	
 public 	void run(){
		
	 		Frame [] fs =new Frame[100];
		
	 		for(int i=0;i<100;i++)
	 	    	{ 
	 	    	try{
		   
	 				sleep(60000);	
	 	    	    fs[i]=new Frame((char)i+" ");
	 	    	    
	 	    	    Panel p=new Panel();		//panel can't exist by itself.
	 				p.add(new Button("press me"));
	 				p.setBackground(Color.blue);
	 	    		    
	 	    		fs[i].add(p);
	 	    		fs[i].setSize(300*i,400*i);
	 	    		//fs[i].setsize(400,300);
	 	    		fs[i].setVisible(true);
	 	    		fs[i].getName();
	 	    		}catch(InterruptedException e){System.out.println("Sleep Interrupted");}
	 	    	}
	 	    	
	 	    	 }	
		
	public static void main(String args[])throws Exception
	 	{	
	 	    //Frame [] fs =new Frame[100];
	 	   
	 	      
	 	    
	 	    Frame f=new Frame("周元平软件开发开始");
	 		Frame f1=new Frame("中华人民共和国");		
	 		 	
	 		Panel p=new Panel();		//panel can't exist by itself.
	 		p.add(new Button("press me"));
	 		p.setBackground(Color.blue);
	 		f1.add(p);
	 		f1.setSize(300,400);
	 		f1.setBackground(Color.white);
	 		f1.setVisible(true);
	 		
	 		//f.add(new Button("OK"));
	 		f.add(p);
	 		f.setSize(300,500);
	 		f.setVisible(true);
	 		
	 		
	 		SimplePanel Sp=new SimplePanel();
	 		Sp.start();
	 		Thread.sleep(10);
	 		Sp.interrupt();
	 	}
}

⌨️ 快捷键说明

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