📄 cardlayoutapplet.java
字号:
/*
* cardLayoutApplet.java
*
* Created on 2007年5月4日, 上午8:27
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package testApplet;
import java.awt.*;
/**
*
* @author INST
*/
public class cardLayoutApplet extends java.applet.Applet implements Runnable{
/** Initialization method that will be called after the applet is loaded
* into the browser.
*/
public void init() {
// TODO start asynchronous download of heavy resources
setLayout(new CardLayout());
for(int i=1;i<=10;i++)
{
add(new Button("Card "+i),"Card "+i);
}
timer=new Thread(this);
}
public void start()
{
timer.start();
}
// public void stop()
// {
// timer.stop();
// }
//
private Thread timer;
// TODO overwrite start(), stop() and destroy() methods
public void run()
{
CardLayout layout=(CardLayout)getLayout();
Thread t=Thread.currentThread();
while(t==timer)
{
layout.next(this);
try
{
timer.sleep(1000);
}
catch(InterruptedException e)
{
return;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -