aboutframe.java

来自「用java2核心类库写的一个学生课程管理系统」· Java 代码 · 共 61 行

JAVA
61
字号
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class AboutFrame extends JFrame 
{
    private JPanel content;

    private JTextArea test;
    private JButton okButton;
    
    private static final AboutFrame About = new AboutFrame();

    public static AboutFrame singleAboutFrame()
	{
		return About;
	}

    private AboutFrame()
    {
    	initAboutFrame();
    	ClickActionListener  cal = new ClickActionListener();
    	okButton.addActionListener(cal);
    }

	private void initAboutFrame()
    {
        this.setTitle("关于");
        
    	content = new JPanel();
    	test = new JTextArea("软件名: 学生信息管理系统\n" + 
    		                  "版本号: 1.0\n" +
    		                  "开发者: 李忠义\n" + 
    		                  "联系方式: liranke@sina.com");
    
        okButton = new JButton("确定");

    	test.setBackground(content.getBackground());
    	test.setEditable(false);
 
        content.add(test);
        content.add(okButton);
        content.setLayout(new FlowLayout());
        this.add(content);
        this.setSize(300,300);
        this.setVisible(true);
    }	
 
    class ClickActionListener implements ActionListener  
    {    
	   public void actionPerformed(ActionEvent e)
	   	{
	    	if (e.getActionCommand() == "确定")
	    	{
	    	   System.out.println("kkkkkkkkkkkk");
	    	   About.dispose();
	    	}
	    }
    }
}

⌨️ 快捷键说明

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