📄 myframe.java
字号:
/*
* Created on 2007-4-26
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/**
* @author hulmous
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
import java.awt.*;
//import javax.swing.*;
public class Myframe extends Frame{
public Myframe(String s){
super(s);
}
public static void main(String[] args){
String str="HelloWorld";
Myframe frame=new Myframe(str);
frame.setVisible(true);
frame.setSize(200,200);
frame.setBackground(Color.blue);
frame.setLayout(new BorderLayout());
Button b=new Button("确定");
Button b1=new Button("取消");
Label l1=new Label("This is a test");
frame.add(BorderLayout.EAST,b);
frame.add(b1,"Center");
frame.add(l1,"Center");
/*frame.setLayout(new FlowLayout(FlowLayout.CENTER,10,20));
Panel pan=new Panel();
pan.setSize(200,100);
pan.setBackground(Color.orange);
frame.add(pan);
pan.setVisible(true);
JButton b=new JButton("确定");
JButton b1=new JButton("取消");
pan.add(b);
pan.add(b1);
//System.exit(1);*/
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -