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

📄 frame7_3.java

📁 200多个自己编的java程序,大家可以学一下.
💻 JAVA
字号:

//the panel with three button
import java.awt.*;
import java.io.*;

class ThreeButtonsFrame extends Frame{
	private String titlestr;
	private int width = 0;
	private int height = 0;
	private Color mycolor;
	
	public ThreeButtonsFrame(String s,int w,int h, Color c)
	{
		super(s);
		titlestr=s;
		width=w;
		height=h;
		mycolor=c;
	}
	
	
	public void go()
	{
		this.setSize(width,height);
		this.setBackground(mycolor);
		this.setLayout(new FlowLayout(FlowLayout.CENTER,50,50));
		Panel pan=new Panel();
		pan.setSize(100,100);
		pan.setBackground(Color.black);
		Button b1=new Button("operation");
		Button b2=new Button("button1");
		Button b3=new Button("hello");
		pan.add(b1);
		pan.add(b2);
		pan.add(b3);
		this.setVisible(true);
		this.show();
		this.pack();
		
		}
		
}
public class Frame7_3 {
	/**
	 * Method main
	 *
	 *
	 * @param args
	 *
	 */
	public static void main(String[] args) {
		// TODO: Add your code here
		
		ThreeButtonsFrame tbf=new ThreeButtonsFrame("this is a Frame with button",200,300,Color.GREEN);
		tbf.go();
		
	    BufferedReader intemp=new BufferedReader(new InputStreamReader(System.in));
        System.out.println("please return key to exit!!!");
        try{
        	String s=intemp.readLine();
        	
        	
        	
        }
        catch(IOException e)
        {
        	System.out.println(e.toString());
        	System.exit(1);
        	
        }
        System.exit(0);
         
    }
	
}

⌨️ 快捷键说明

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