card.java
来自「nanjing university cs 的java课件。 对新手很有用。付」· Java 代码 · 共 36 行
JAVA
36 行
import java.awt.*;
public class Card extends Frame{
public Card() throws Exception{
CardLayout l = new CardLayout();
this.setLayout(l);
//this.setLayout(new GridLayout(2,2));
//this.setLayout(new GridLayout(2,2,10,5));
add(new Button("1"), "First");
add(new Button("2"), "Second");
add(new Button("3"), "Third");
add(new Button("4"), "Fourth");
add(new Button("5"), "Fifth");
add(new Button("6"), "Sixth");
this.setSize(400,400);
this.setVisible(true);//1
Thread.sleep(1000);
l.next(this);//2
Thread.sleep(1000);
l.next(this);//3
Thread.sleep(1000);
l.show(this, "Fifth");//5
Thread.sleep(1000);
l.next(this);//6
Thread.sleep(1000);
l.previous(this);//5
Thread.sleep(1000);
l.show(this, "Second");//2
Thread.sleep(1000);
l.last(this);//6
}
public static void main(String[] args) throws Exception{
Card s = new Card();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?