📄 e732. the quintessential swing user interface.txt
字号:
This example creates and shows a frame with a button. To enable the button to respond to button clicks, see e743 Creating a JButton Component.
import java.awt.*;
import javax.swing.*;
public class BasicUI {
public static void main(String[] args) {
JButton button = new JButton("Label");
JFrame frame = new JFrame();
// Add button to the frame
frame.getContentPane().add(button, BorderLayout.CENTER);
// Set initial size
int frameWidth = 300;
int frameHeight = 300;
frame.setSize(frameWidth, frameHeight);
// Show the frame
frame.setVisible(true);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -