frame2.java~3~

来自「这是我最得意的一件小作品。它是一个基于C/S模式的网络考试系统」· JAVA~3~ 代码 · 共 71 行

JAVA~3~
71
字号
package testsystem;

import java.awt.*;

import javax.swing.*;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2009</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class Frame2 extends JFrame {
    JPanel contentPane;
    JButton jButton1 = new JButton();
    JTextField jTextField1 = new JTextField();
    XYLayout xYLayout1 = new XYLayout();

    public Frame2() {
        try {
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            jbInit();
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }

    /**
     * Component initialization.
     *
     * @throws java.lang.Exception
     */
    private void jbInit() throws Exception {
        contentPane = (JPanel) getContentPane();
        contentPane.setLayout(xYLayout1);
        setSize(new Dimension(400, 300));
        setTitle("Frame Title");
        jButton1.setText("New ");
        jButton1.addActionListener(new Frame2_jButton1_actionAdapter(this));
        jTextField1.setText("jTextField1");
        contentPane.add(jButton1, new XYConstraints(18, 88, -1, -1));
        contentPane.add(jTextField1, new XYConstraints(152, 90, -1, -1));
    }

    public void jButton1_actionPerformed(ActionEvent e) {
          System.exit(0);
    }
}


class Frame2_jButton1_actionAdapter implements ActionListener {
    private Frame2 adaptee;
    Frame2_jButton1_actionAdapter(Frame2 adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.jButton1_actionPerformed(e);
    }
}

⌨️ 快捷键说明

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