希望对各位有所帮助
源代码在线查看: mainmenu.java~28~
软件大小: |
2491 K |
上传用户: |
haibokaishi2006 |
|
|
关键词: |
|
下载地址: |
免注册下载 普通下载
|
|
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
* Title:
* Description:
* Copyright: Copyright (c) 2003
* Company:
* @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 jMItemHouseQuery = new JMenuItem();
JMenuItem jMItemQuery = new JMenuItem();
JMenuItem jMItemComboQuery = 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("查询");
jMItemHouseQuery.setBackground(SystemColor.controlHighlight);
jMItemHouseQuery.setFont(new java.awt.Font("宋体", 0, 12));
jMItemHouseQuery.setText("房产信息查询");
jMItemQuery.setBackground(SystemColor.controlHighlight);
jMItemQuery.setFont(new java.awt.Font("宋体", 0, 12));
jMItemQuery.setText("信息查询");
jMItemQuery.addActionListener(new
MainMenu_jMItemQuery_actionAdapter(this));
jMItemComboQuery.setFont(new java.awt.Font("宋体", 0, 12));
jMItemComboQuery.setText("组合查询");
jMItemComboQuery.addActionListener(new
MainMenu_jMItemComboQuery_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();
}
void jMItemComboQuery_actionPerformed(ActionEvent e) {
}
}
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);
}
}
class MainMenu_jMItemComboQuery_actionAdapter
implements java.awt.event.ActionListener {
MainMenu adaptee;
MainMenu_jMItemComboQuery_actionAdapter(MainMenu adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jMItemComboQuery_actionPerformed(e);
}
}