?? mainmenu.java
字號:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
public class MainMenu
extends JFrame {
JPanel contentPane;
JMenuBar jMenuBar = new JMenuBar();
JMenu jMenuSystem = new JMenu();
JMenuItem jMItemExit = new JMenuItem();
JMenu jMenuHouseManager = new JMenu();
JMenuItem jMItemBuildInfo = new JMenuItem();
BorderLayout borderLayout1 = new BorderLayout();
JMenuItem jMItemCodeSet = new JMenuItem();
JMenuItem jMItemHouseInfo = new JMenuItem();
JMenu jMenuOwner = new JMenu();
JMenuItem jMItemBasicInfo = new JMenuItem();
JMenuItem jMItemFamilyInfo = new JMenuItem();
JMenu jMenuQuery = new JMenu();
JMenuItem jMItemQuery = new JMenuItem();
//Construct the frame
public MainMenu() {
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.getContentPane().setBackground(SystemColor.controlLtHighlight);
this.setSize(new Dimension(576, 372));
this.setTitle("房產管理系統");
jMenuSystem.setBackground(SystemColor.controlHighlight);
jMenuSystem.setFont(new java.awt.Font("宋體", 0, 12));
jMenuSystem.setText("系統管理");
jMItemExit.setBackground(SystemColor.controlHighlight);
jMItemExit.setFont(new java.awt.Font("宋體", 0, 12));
jMItemExit.setText("退出");
jMItemExit.addActionListener(new MainMenu_jMItemExit_actionAdapter(this));
jMenuHouseManager.setBackground(SystemColor.controlHighlight);
jMenuHouseManager.setFont(new java.awt.Font("宋體", 0, 12));
jMenuHouseManager.setFocusPainted(true);
jMenuHouseManager.setText("房產管理");
jMItemBuildInfo.setBackground(SystemColor.controlHighlight);
jMItemBuildInfo.setFont(new java.awt.Font("宋體", 0, 12));
jMItemBuildInfo.setText("房產信息維護");
jMItemBuildInfo.addActionListener(new
MainMenu_jMItemBuildInfo_actionAdapter(this));
jMItemCodeSet.setBackground(SystemColor.controlHighlight);
jMItemCodeSet.setFont(new java.awt.Font("宋體", 0, 12));
jMItemCodeSet.setText("代碼表設置");
jMItemCodeSet.addActionListener(new MainMenu_jMItemCodeSet_actionAdapter(this));
jMenuSystem.addSeparator();
jMenuBar.setFont(new java.awt.Font("宋體", 0, 12));
jMItemHouseInfo.setBackground(SystemColor.controlHighlight);
jMItemHouseInfo.setFont(new java.awt.Font("宋體", 0, 12));
jMItemHouseInfo.setText("住房信息維護");
jMItemHouseInfo.addActionListener(new
MainMenu_jMItemHouseInfo_actionAdapter(this));
jMenuOwner.setBackground(SystemColor.controlHighlight);
jMenuOwner.setFont(new java.awt.Font("宋體", 0, 12));
jMenuOwner.setText("住戶管理");
jMItemBasicInfo.setBackground(SystemColor.controlHighlight);
jMItemBasicInfo.setFont(new java.awt.Font("宋體", 0, 12));
jMItemBasicInfo.setToolTipText("");
jMItemBasicInfo.setText("基本信息維護");
jMItemBasicInfo.addActionListener(new
MainMenu_jMItemBasicInfo_actionAdapter(this));
jMItemFamilyInfo.setBackground(SystemColor.controlHighlight);
jMItemFamilyInfo.setFont(new java.awt.Font("宋體", 0, 12));
jMItemFamilyInfo.setText("家庭信息維護");
jMItemFamilyInfo.addActionListener(new
MainMenu_jMItemFamilyInfo_actionAdapter(this));
jMenuQuery.setFont(new java.awt.Font("宋體", 0, 12));
jMenuQuery.setText("查詢");
jMItemQuery.setBackground(SystemColor.controlHighlight);
jMItemQuery.setFont(new java.awt.Font("宋體", 0, 12));
jMItemQuery.setText("信息查詢");
jMItemQuery.addActionListener(new
MainMenu_jMItemQuery_actionAdapter(this));
jMenuSystem.add(jMItemCodeSet);
jMenuSystem.addSeparator();
jMenuSystem.add(jMItemExit);
jMenuHouseManager.add(jMItemBuildInfo);
jMenuHouseManager.add(jMItemHouseInfo);
jMenuBar.add(jMenuSystem);
jMenuBar.add(jMenuHouseManager);
jMenuBar.add(jMenuOwner);
jMenuBar.add(jMenuQuery);
jMenuOwner.add(jMItemBasicInfo);
jMenuOwner.add(jMItemFamilyInfo);
jMenuQuery.add(jMItemQuery);
this.setJMenuBar(jMenuBar);
}
//代碼表設置菜單響應事件
void jMItemCodeSet_actionPerformed(ActionEvent e) {
//生成一個代碼表維護類函數
CodeSet codeSet = new CodeSet();
//設置窗體大小
Dimension dlgSize = codeSet.getPreferredSize();
Dimension frmSize = getSize();
//設置窗體位置
Point loc = getLocation();
codeSet.setLocation( (frmSize.width - dlgSize.width) / 2 + loc.x,
(frmSize.height - dlgSize.height) / 2 + loc.y);
codeSet.pack();
//顯示窗體
codeSet.show();
}
//退出
void jMItemExit_actionPerformed(ActionEvent e) {
System.exit(0);
}
//房產信息維護菜單響應事件
void jMItemBuildInfo_actionPerformed(ActionEvent e) {
BuildInfo buildInfo = new BuildInfo();
Dimension dlgSize = buildInfo.getPreferredSize();
Dimension frmSize = getSize();
Point loc = getLocation();
buildInfo.setLocation( (frmSize.width - dlgSize.width) / 2 + loc.x,
(frmSize.height - dlgSize.height) / 2 + loc.y);
buildInfo.pack();
buildInfo.show();
}
//住房信息維護菜單響應事件
void jMItemHouseInfo_actionPerformed(ActionEvent e) {
HouseInfo houseInfo = new HouseInfo();
Dimension dlgSize = houseInfo.getPreferredSize();
Dimension frmSize = getSize();
Point loc = getLocation();
houseInfo.setLocation( (frmSize.width - dlgSize.width) / 2 + loc.x,
(frmSize.height - dlgSize.height) / 2 + loc.y);
houseInfo.pack();
houseInfo.show();
}
//房主基本信息維護菜單響應事件
void jMItemBasicInfo_actionPerformed(ActionEvent e) {
OwnerInfo ownerInfo = new OwnerInfo();
Dimension dlgSize = ownerInfo.getPreferredSize();
Dimension frmSize = getSize();
Point loc = getLocation();
ownerInfo.setLocation( (frmSize.width - dlgSize.width) / 2 + loc.x,
(frmSize.height - dlgSize.height) / 2 + loc.y);
ownerInfo.pack();
ownerInfo.show();
}
//房主家庭信息維護菜單響應事件
void jMItemFamilyInfo_actionPerformed(ActionEvent e) {
FamilyInfo familyInfo = new FamilyInfo();
Dimension dlgSize = familyInfo.getPreferredSize();
Dimension frmSize = getSize();
Point loc = getLocation();
familyInfo.setLocation( (frmSize.width - dlgSize.width) / 2 + loc.x,
(frmSize.height - dlgSize.height) / 2 + loc.y);
familyInfo.pack();
familyInfo.show();
}
//查詢菜單響應事件
void jMItemQuery_actionPerformed(ActionEvent e) {
Query query = new Query();
Dimension dlgSize = query.getPreferredSize();
Dimension frmSize = getSize();
Point loc = getLocation();
query.setLocation( (frmSize.width - dlgSize.width) / 2 + loc.x,
(frmSize.height - dlgSize.height) / 2 + loc.y);
query.pack();
query.show();
}
}
class MainMenu_jMItemCodeSet_actionAdapter
implements java.awt.event.ActionListener {
MainMenu adaptee;
MainMenu_jMItemCodeSet_actionAdapter(MainMenu adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jMItemCodeSet_actionPerformed(e);
}
}
class MainMenu_jMItemExit_actionAdapter
implements java.awt.event.ActionListener {
MainMenu adaptee;
MainMenu_jMItemExit_actionAdapter(MainMenu adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jMItemExit_actionPerformed(e);
}
}
class MainMenu_jMItemBuildInfo_actionAdapter
implements java.awt.event.ActionListener {
MainMenu adaptee;
MainMenu_jMItemBuildInfo_actionAdapter(MainMenu adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jMItemBuildInfo_actionPerformed(e);
}
}
class MainMenu_jMItemHouseInfo_actionAdapter
implements java.awt.event.ActionListener {
MainMenu adaptee;
MainMenu_jMItemHouseInfo_actionAdapter(MainMenu adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jMItemHouseInfo_actionPerformed(e);
}
}
class MainMenu_jMItemBasicInfo_actionAdapter
implements java.awt.event.ActionListener {
MainMenu adaptee;
MainMenu_jMItemBasicInfo_actionAdapter(MainMenu adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jMItemBasicInfo_actionPerformed(e);
}
}
class MainMenu_jMItemFamilyInfo_actionAdapter
implements java.awt.event.ActionListener {
MainMenu adaptee;
MainMenu_jMItemFamilyInfo_actionAdapter(MainMenu adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jMItemFamilyInfo_actionPerformed(e);
}
}
class MainMenu_jMItemQuery_actionAdapter
implements java.awt.event.ActionListener {
MainMenu adaptee;
MainMenu_jMItemQuery_actionAdapter(MainMenu adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jMItemQuery_actionPerformed(e);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -