aboutdialog.java

来自「本人写的一个简单VCD租赁系统」· Java 代码 · 共 106 行

JAVA
106
字号
//************************************************//AboutDialog.java//This class is used to create an "about" dialog.//Created by Xiaobin Lin               2/Dec/2004//************************************************package Main;import javax.swing.*;import javax.swing.WindowConstants;import java.awt.*;import java.awt.event.*;public class AboutDialog extends JDialog {        //Constructor: automatically invoked when a new instance of AboutDialog is created    public AboutDialog(Frame parent, boolean modal) {        super(parent, modal);        initComponents();    }        // This method is called from within the constructor to    // initialize the GUI for the about dialog.    private void initComponents() {        buttonOk = new JButton();        textFieldSoftwareName = new JTextField();        textFieldSoftwareVersion = new JTextField();        textFieldAuthor = new JTextField();        textFieldOrganisation = new JTextField();        getContentPane().setLayout(null);        setDefaultCloseOperation(DISPOSE_ON_CLOSE);        setTitle("About");        setName("dialogAbout");        setResizable(false);        buttonOk.setFont(new java.awt.Font("Times New Roman", 0, 12));        buttonOk.setText("OK");        buttonOk.setMnemonic('o');        buttonOk.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent evt) {                buttonOkActionPerformed(evt);            }        });        getContentPane().add(buttonOk);        buttonOk.setBounds(150, 130, 80, 23);        textFieldSoftwareName.setFont(new Font("Times New Roman", 3, 14));        textFieldSoftwareName.setText("Have-Videos-Must-Watch");        textFieldSoftwareName.setBorder(null);        textFieldSoftwareName.setFocusable(false);        textFieldSoftwareName.setOpaque(false);                getContentPane().add(textFieldSoftwareName);        textFieldSoftwareName.setBounds(110, 10, 160, 17);        textFieldSoftwareVersion.setFont(new Font("Times New Roman", 3, 13));        textFieldSoftwareVersion.setText("V1.0");        textFieldSoftwareVersion.setBorder(null);        textFieldSoftwareVersion.setFocusable(false);        textFieldSoftwareVersion.setOpaque(false);        getContentPane().add(textFieldSoftwareVersion);        textFieldSoftwareVersion.setBounds(170, 40, 40, 16);        textFieldAuthor.setFont(new Font("Times New Roman", 3, 13));        textFieldAuthor.setText("Author: Xiaobin Lin");        textFieldAuthor.setBorder(null);        textFieldAuthor.setFocusable(false);        textFieldAuthor.setOpaque(false);        getContentPane().add(textFieldAuthor);        textFieldAuthor.setBounds(120, 70, 140, 16);        textFieldOrganisation.setFont(new Font("Times New Roman", 3, 13));        textFieldOrganisation.setText("University of Sunderland, UK");        textFieldOrganisation.setBorder(null);        textFieldOrganisation.setFocusable(false);        textFieldOrganisation.setOpaque(false);        getContentPane().add(textFieldOrganisation);        textFieldOrganisation.setBounds(100, 100, 180, 16);        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();        setBounds((screenSize.width-400)/2, (screenSize.height-200)/2, 400, 200);    }    //When Ok button is pressed, close dialog    private void buttonOkActionPerformed(ActionEvent evt) {        closeDialog();    }        //close dialog    private void closeDialog(){        setVisible(false);        dispose();    }                // Variables declaration - GUI-related    private JButton buttonOk;    private JTextField textFieldAuthor;    private JTextField textFieldOrganisation;    private JTextField textFieldSoftwareName;    private JTextField textFieldSoftwareVersion;     }

⌨️ 快捷键说明

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