📄 frame7_1_2withpanel.java
字号:
import java.awt.*;
import java.io.*;
// this is not the main class ,so it does not need public state
class Frame1WithPanel extends Frame{
private String titlestr;
private int width;
private int height;
private Color myColor;
public boolean b = true;
/**
* Method go
*
*
*/
public void go() {
this.setSize(width,height);
// this.setBackground(myColor);
this.setLayout(null);
Button quit=new Button("quit");
Panel pan=new Panel();
pan.setSize(100,100);
pan.setBackground(Color.yellow);
pan.setVisible(true);
this.add(quit);
this.add(pan);
this.setVisible(b);
}
/**
* Method Frame7_1_2
*
*
*/
public Frame1WithPanel(String s,int w,int h) {
super(s);
titlestr=s;
height=h;
width=w;
// TODO: Add your code here
}
// TODO: Add your code here
}
public class Frame7_1_2WithPanel {
/**
* Method main
*
*
* @param args
*
*/
public static void main(String[] args) {
Frame1 fr1=new Frame1WithPanel("MyFrame",1200,300);
fr1.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);
}
// TODO: Add your code here
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -