📄 myframe.java
字号:
import java.awt.*;
public class MyFrame extends Thread
{
public void run()
{
while(true)
{
cl.previous(p);
try
{
Thread.sleep(1000);
}catch(Exception e){}
}
}
static Panel p=new Panel();
static CardLayout cl=new CardLayout();
public static void main(String[] args)
{
Frame f=new Frame("my first frame!");
f.setSize(300,400);
f.setLocation(200,100);
f.setBackground(Color.yellow);
f.setLayout(new BorderLayout(5,10));
TextField tf=new TextField();
Button[] brr=new Button[30];
for(int i=0;i<brr.length;i++)
{
brr[i]=new Button(""+i);
}
p.setLayout(cl);
for(int i=0;i<brr.length;i++)
{
p.add(brr[i],""+i);
}
//Button bt=new Button("exit");
f.add(tf,BorderLayout.NORTH);
f.add(p,BorderLayout.CENTER);
//MyFrame1 f=new MyFrame1("my second frame");
f.setVisible(true);
MyFrame mf=new MyFrame();
mf.start();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -