?? trycardlayout.java
字號(hào):
import javax.swing.*;
import java.awt.*;
import java.awt.event.*; // Classes to handle events
public class TryCardLayout extends JApplet
implements ActionListener // For event handling
{
CardLayout card = new CardLayout(50,50); // Create layout
public void init()
{
Container content = getContentPane();
content.setLayout(card); // Set card as the layout mgr
JButton button; // Stores a button
for(int i = 1; i <= 6; i++)
{
content.add(button = new JButton("Press " + i), "Card" + i); // Add a button
button.addActionListener(this); // Add listener for button
}
}
// Handle button events
public void actionPerformed(ActionEvent e)
{
card.next(getContentPane()); // Switch to the next card
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -