⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 innerclassdemo.java

📁 初期JAVA学习非常有用的资料。帮助深入了解API。特别是Applet。
💻 JAVA
字号:
//1.2, 1.3, and compatible releases.  Works in 1.1 if you add
//JFC/Swing 1.1.

import javax.swing.*;          
import java.awt.*;
import java.awt.event.*;

public class InnerClassDemo {
    public Component createComponents() {
        JButton button = new JButton("Quit");
        //button.addActionListener(new MyActionListener());

        JPanel pane = new JPanel();
        pane.setBorder(BorderFactory.createEmptyBorder(
                                        30, //top
                                        30, //left
                                        30, //bottom
                                        30) //right
                                        );
        pane.setLayout(new GridLayout(0, 1));
        pane.add(button);

        return pane;
    }

    protected void quit() {
        System.exit(0);
    }

    public static void main(String[] args) {
        //Create the top-level container and add contents to it.
        JFrame frame = new JFrame("Inner Class Demo");
        final InnerClassDemo app = new InnerClassDemo();
        Component contents = app.createComponents();
        frame.getContentPane().add(contents, BorderLayout.CENTER);

        //Finish setting up the frame, and show it.
        frame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                app.quit();
            }
        });
        frame.pack();
        frame.setVisible(true);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -