📄 mainframe.java
字号:
package family;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
import java.io.*;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2005</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
public class MainFrame extends JFrame {
JPanel contentPane;//主窗体内容网格
BorderLayout borderLayout1 = new BorderLayout();//主窗体布局管理
JToolBar jToolBar1 = new JToolBar();//工具栏
JButton jButton1 = new JButton();//口令维护按钮
JButton jButton2 = new JButton();//家庭理财功能按钮
JButton jButton3 = new JButton();//资产管理功能按钮
JButton jButton4 = new JButton();//数据库维护功能按钮
JButton jButton5 = new JButton();//退出系统功能按钮
JPanel jPanel1 = new JPanel();//蓝色区域面板
XYLayout xYLayout1 = new XYLayout();//蓝色区域布局管理
JLabel jLabel1 = new JLabel();//蓝色区域中软件名称标签
//Construct the frame
public MainFrame() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
//Component initialization
private void jbInit() throws Exception {
contentPane = (JPanel) this.getContentPane();
contentPane.setLayout(borderLayout1);
this.setResizable(false);
this.setSize(new Dimension(630, 448));
this.setTitle("Family");
jButton1.setFont(new java.awt.Font("DialogInput", 0, 12));
jButton1.setMaximumSize(new Dimension(79, 49));
jButton1.setMinimumSize(new Dimension(79, 49));
jButton1.setPreferredSize(new Dimension(79, 49));
jButton1.setText("口令维护");
jButton1.addActionListener(new MainFrame_jButton1_actionAdapter(this));
jButton2.setFont(new java.awt.Font("DialogInput", 0, 12));
jButton2.setMaximumSize(new Dimension(79, 49));
jButton2.setMinimumSize(new Dimension(79, 49));
jButton2.setPreferredSize(new Dimension(79, 49));
jButton2.setText("家庭理财");
jButton2.addActionListener(new MainFrame_jButton2_actionAdapter(this));
jButton3.setFont(new java.awt.Font("DialogInput", 0, 12));
jButton3.setMaximumSize(new Dimension(79, 49));
jButton3.setMinimumSize(new Dimension(79, 49));
jButton3.setPreferredSize(new Dimension(79, 49));
jButton3.setText("资产管理");
jButton3.addActionListener(new MainFrame_jButton3_actionAdapter(this));
jButton4.setFont(new java.awt.Font("DialogInput", 0, 12));
jButton4.setMaximumSize(new Dimension(79, 49));
jButton4.setMinimumSize(new Dimension(79, 49));
jButton4.setPreferredSize(new Dimension(79, 49));
jButton4.setActionCommand("密码管理");
jButton4.setText("退出系统");
jButton4.addActionListener(new MainFrame_jButton5_actionAdapter(this));
jButton5.setFont(new java.awt.Font("DialogInput", 0, 12));
jButton5.setMaximumSize(new Dimension(79, 49));
jButton5.setMinimumSize(new Dimension(79, 49));
jButton5.setPreferredSize(new Dimension(79, 49));
jButton5.setText("数据库管理");
jButton5.addActionListener(new MainFrame_jButton6_actionAdapter(this));
jPanel1.setBackground(SystemColor.inactiveCaption);
jPanel1.setLayout(xYLayout1);
jLabel1.setFont(new java.awt.Font("DialogInput", 1, 48));
jLabel1.setForeground(Color.yellow);
jLabel1.setRequestFocusEnabled(true);
jLabel1.setText("家庭理财工具");
contentPane.add(jToolBar1, BorderLayout.NORTH);
jToolBar1.add(jButton1, null);
jToolBar1.add(jButton2, null);
jToolBar1.add(jButton3, null);
jToolBar1.add(jButton5, null);
jToolBar1.add(jButton4, null);
contentPane.add(jPanel1, BorderLayout.CENTER);
jPanel1.add(jLabel1, new XYConstraints(164, 102, 356, 102));
}
//Overridden so we can exit when window is closed
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
}
}
void jButton1_actionPerformed(ActionEvent e) {
User_Dialog dlg = new User_Dialog();
Dimension dlgSize = dlg.getPreferredSize();
Dimension frmSize = getSize();
Point loc = getLocation();
dlg.setLocation( (frmSize.width - dlgSize.width) / 2 + loc.x,
(frmSize.height - dlgSize.height) / 2 + loc.y);
dlg.setModal(true);
dlg.pack();
dlg.show();
}
void jButton2_actionPerformed(ActionEvent e) {
Money_Dialog dlg = new Money_Dialog();
Dimension dlgSize = dlg.getPreferredSize();
Dimension frmSize = getSize();
Point loc = getLocation();
dlg.setLocation( (frmSize.width - dlgSize.width) / 2 + loc.x,
(frmSize.height - dlgSize.height) / 2 + loc.y);
dlg.setModal(true);
dlg.pack();
dlg.show();
}
void jButton3_actionPerformed(ActionEvent e) {
Estate_Dialog dlg = new Estate_Dialog();
Dimension dlgSize = dlg.getPreferredSize();
Dimension frmSize = getSize();
Point loc = getLocation();
dlg.setLocation( (frmSize.width - dlgSize.width) / 2 + loc.x,
(frmSize.height - dlgSize.height) / 2 + loc.y);
dlg.setModal(true);
dlg.pack();
dlg.show();
}
void jButton6_actionPerformed(ActionEvent e) {
DB_Dialog dlg = new DB_Dialog();
Dimension dlgSize = dlg.getPreferredSize();
Dimension frmSize = getSize();
Point loc = getLocation();
dlg.setLocation( (frmSize.width - dlgSize.width) / 2 + loc.x,
(frmSize.height - dlgSize.height) / 2 + loc.y);
dlg.setModal(true);
dlg.pack();
dlg.show();
}
void jButton5_actionPerformed(ActionEvent e) {
System.exit(0);
}
}
class MainFrame_jButton1_actionAdapter implements java.awt.event.ActionListener {
MainFrame adaptee;
MainFrame_jButton1_actionAdapter(MainFrame adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e);
}
}
class MainFrame_jButton2_actionAdapter implements java.awt.event.ActionListener {
MainFrame adaptee;
MainFrame_jButton2_actionAdapter(MainFrame adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton2_actionPerformed(e);
}
}
class MainFrame_jButton3_actionAdapter implements java.awt.event.ActionListener {
MainFrame adaptee;
MainFrame_jButton3_actionAdapter(MainFrame adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton3_actionPerformed(e);
}
}
class MainFrame_jButton6_actionAdapter implements java.awt.event.ActionListener {
MainFrame adaptee;
MainFrame_jButton6_actionAdapter(MainFrame adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton6_actionPerformed(e);
}
}
class MainFrame_jButton5_actionAdapter implements java.awt.event.ActionListener {
MainFrame adaptee;
MainFrame_jButton5_actionAdapter(MainFrame adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton5_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -