📄 frame1_aboutbox.java
字号:
package calculator;import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.border.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2006</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class Frame1_AboutBox extends JDialog implements ActionListener { JPanel panel1 = new JPanel(); JPanel panel2 = new JPanel(); JPanel insetsPanel1 = new JPanel(); JPanel insetsPanel2 = new JPanel(); JLabel imageLabel = new JLabel(); ImageIcon image1,image2; BorderLayout borderLayout1 = new BorderLayout(); BorderLayout borderLayout2 = new BorderLayout(); String product = ""; String version = "1.0"; String copyright = "Copyright (c) 2006"; String comments = ""; GridLayout gridLayout2 = new GridLayout(); JLabel jLabel1 = new JLabel(); JPanel jPanel1 = new JPanel(); GridLayout gridLayout1 = new GridLayout(); JTextArea jTextArea1 = new JTextArea(); JLabel jLabel2 = new JLabel(); BorderLayout borderLayout3 = new BorderLayout(); JPanel jPanel2 = new JPanel(); JButton button1 = new JButton(); public Frame1_AboutBox(Frame parent) { // super(parent); enableEvents(AWTEvent.WINDOW_EVENT_MASK); try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } Frame1_AboutBox() { this(null); } //Component initialization private void jbInit() throws Exception { image1 = new ImageIcon(calculator.Frame1.class.getResource("about.png")); image2 = new ImageIcon(calculator.Frame1.class.getResource("goout.png")); imageLabel.setIcon(image1); jLabel1.setHorizontalAlignment(SwingConstants.CENTER); jLabel1.setIcon(image2); this.setTitle("关于计算器"); panel1.setLayout(borderLayout1); panel2.setLayout(borderLayout2); insetsPanel2.setLayout(gridLayout2); insetsPanel2.setBackground(Color.white); insetsPanel2.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); panel1.setBackground(Color.white); insetsPanel1.setBackground(Color.white); insetsPanel1.setLayout(borderLayout3); gridLayout2.setColumns(0); gridLayout2.setRows(1); jPanel1.setLayout(gridLayout1); gridLayout1.setColumns(1); gridLayout1.setRows(0); jTextArea1.setEnabled(false); jTextArea1.setBorder(BorderFactory.createEtchedBorder()); jTextArea1.setOpaque(false); jTextArea1.setDisabledTextColor(Color.black); jTextArea1.setEditable(false); String username=System.getProperty("user.name");//获取当前操作系统用户名 jTextArea1.setText( "软件名 :Neutron Calculator L-1.0 "+'\n'+ "版本号 :L-1.0"+'\n'+ "授权给 :"+username+'\n'+ "历史版本 :"+'\n'+ " 1) C1.0 :2006.2.9 最原始的四则运算,拥有简陋的退格键,支持记忆 M,不支持键盘输入."+'\n'+ " 2) C1.1 :2006.2.10 在1.0的基础上加入了键盘输入,方便了输入运算,修改了1.0的一些BUG."+'\n'+ " 3) V200 :2006.2.12 由于修改地方过多,直接升级到V200版,全新的版本支持部分科学运算,修"+'\n'+ " 正了退格键的工作原理,优化了代码,增加了常量E输入,和负数输入,外观改为可折叠式!"+'\n'+ " 4) L-1.0 :2006.3.14 DC工作室改名为Neutron中子星工作室,L-1.0在V200的基础上大大优"+'\n'+ " 化了内核的代码,使程序更加合理,在支持V200的所有功能的基础上,修正了V200许多BUG,"+'\n'+ " 并增加了几个常量的输入和几个科学运算功能,支持连续运算,外观窗体采用了布局技术,"+'\n'+ " 使得程序能在各操作系统都正常运行"+'\n'+'\n'+ "★该软件为Neutron工作室制作,欢迎任何人传播使用,但不得作商业用途!违者必究!目前该软件还在不断完善中."+'\n'+ "★作者:lanner"); jTextArea1.setLineWrap(true); panel2.setBackground(Color.white); jPanel1.setBackground(Color.white); jLabel2.setFont(new java.awt.Font("Dialog", 1, 12)); jLabel2.setForeground(Color.red); jLabel2.setRequestFocusEnabled(true); jLabel2.setHorizontalAlignment(SwingConstants.RIGHT); jLabel2.setText("Neutron Copyright (c) 2006 "); button1.setText("Ok"); button1.addActionListener(new Frame1_AboutBox_button1_actionAdapter(this)); button1.addActionListener(this); jPanel2.setBackground(Color.white); insetsPanel2.add(imageLabel, null); insetsPanel2.add(jLabel1, null); panel1.add(jPanel1, BorderLayout.CENTER); panel2.add(insetsPanel2, BorderLayout.CENTER); this.getContentPane().add(panel1, null); insetsPanel1.add(jLabel2, BorderLayout.EAST); insetsPanel1.add(jPanel2, BorderLayout.CENTER); jPanel2.add(button1, null); panel1.add(insetsPanel1, BorderLayout.SOUTH); panel1.add(panel2, BorderLayout.NORTH); jPanel1.add(jTextArea1, null); setResizable(true); } //Overridden so we can exit when window is closed protected void processWindowEvent(WindowEvent e) { if (e.getID() == WindowEvent.WINDOW_CLOSING) { cancel(); } super.processWindowEvent(e); } //Close the dialog void cancel() { dispose(); } //Close the dialog on a button event public void actionPerformed(ActionEvent e) { if (e.getSource() == button1) { cancel(); } } void button1_actionPerformed(ActionEvent e) { }}class Frame1_AboutBox_button1_actionAdapter implements java.awt.event.ActionListener { Frame1_AboutBox adaptee; Frame1_AboutBox_button1_actionAdapter(Frame1_AboutBox adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.button1_actionPerformed(e); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -