📄 simpleapplet2.java
字号:
// SimpleApplet2.java// A contrived example of how to add components to an applet after it has// been initialized. Code to disable the event queue checking is included// (but commented out) for use with older plug-ins.//package jswing.ch08;import javax.swing.*;import java.awt.*;public class SimpleApplet2 extends JApplet { public SimpleApplet2() { // Suppress warning message on older versions if needed... // getRootPane().putClientProperty("defeatSystemEventQueueCheck", // Boolean.TRUE); } public void start() { SwingUtilities.invokeLater(new Runnable() { public void run() { // run in the event thread . . . JPanel p = new JPanel(); p.setLayout(new GridLayout(2, 2, 2, 2)); p.add(new JLabel("Username")); p.add(new JTextField()); p.add(new JLabel("Password")); p.add(new JPasswordField()); Container content = getContentPane(); content.setLayout(new GridBagLayout()); // used to center the panel content.add(p); validate(); } }); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -