test.java
来自「swing 教程,与大家分享一下,哈哈,希望大家多多指教」· Java 代码 · 共 37 行
JAVA
37 行
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Test extends JApplet {
public void init() {
Container contentPane = getContentPane();
Icon icon = new ImageIcon("swing.gif");
JLabel label = new JLabel(icon);
contentPane.setLayout(new FlowLayout());
contentPane.add(label = new JLabel(icon));
contentPane.add(label);
}
public static void main(String args[]) {
final JFrame f = new JFrame();
JApplet applet = new Test();
applet.init();
f.setContentPane(applet.getContentPane());
f.setBounds(100,100,308,199);
f.setTitle("An Application");
f.setVisible(true);
f.setDefaultCloseOperation(
WindowConstants.DISPOSE_ON_CLOSE);
f.addWindowListener(new WindowAdapter() {
public void windowClosed(WindowEvent e) {
System.exit(0);
}
});
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?