import java.awt.*;
import java.awt.event.*;
class Test{
public static void main(String [] args){
Frame f=new Frame("变换");
CardLayout c1=new CardLayout();
f.setLayout(c1);
Button b []=new Button[4];
for(int i=0;i<4;i++){
b[i]=new Button("第"+i+"页");
f.add(b[i],"page"+i);
}
b[0].setBackground(Color.red);
b[1].setBackground(Color.blue);
b[2].setBackground(Color.cyan);
b[3].setBackground(Color.green);
f.pack();
f.setVisible(true);
while(true){
try{
Thread.sleep(50);
}
catch (InterruptedException e){
e.printStackTrace();
}
c1.next(f);
}
}
}
posted on 2009-03-23 09:26
鹏凌 阅读(272)
评论(0) 编辑 收藏 所属分类:
Windows 、
java