package com.bluedot.bookcity;
import java.awt.Menu;
import java.awt.MenuBar;
import java.awt.MenuItem;
import java.awt.Panel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import com.bluedot.bookcity.book.business.BookAddPanel;
import com.bluedot.bookcity.book.business.BookQueryPanel;
import com.bluedot.bookcity.book.ui.BookListPanel;
import com.bluedot.bookcity.inmain.ui.InListPanel;
import com.bluedot.bookcity.stock.business.StockQueryPanel;
import com.bluedot.bookcity.stock.ui.StockListPanel;
import com.bluedot.bookcity.user.business.UserAddPanel;
import com.bluedot.bookcity.user.business.UserQueryPanel;
import com.bluedot.bookcity.user.ui.UserListPanel;
import com.bluedot.bookcity.util.ui.AppPanel;
public class MainFrame extends JFrame{
Panel mainPanel=null;
public MainFrame() {
super("图书进销存系统");
this.setBounds(0, 0, 800, 600);
this.setLayout(null);
this.setResizable(false);
mainPanel=new AppPanel();
this.add(mainPanel);
this.setVisible(true);
mainBar=new MenuBar();
this.setMenuBar(mainBar);
mainBarInit();
}
public static MenuBar mainBar=null;
public static Menu menu_user,menu_book,menu_in,menu_out,menu_stock;
MenuItem item_user_list,item_user_add,item_user_query,item_user_delete;
private void mainBarInit() {
menu_user = new Menu("用户管理");
item_user_list = new MenuItem("用户信息列表");
item_user_list.addActionListener(new MyListener());
menu_user.add(item_user_list);
item_user_add = new MenuItem("添加用户信息");
item_user_add.addActionListener(new MyListener());
menu_user.add(item_user_add);
item_user_query = new MenuItem("查询用户信息");
item_user_query.addActionListener(new MyListener());
menu_user.add(item_user_query);
//mainBar.add(menu_user);
MenuItem item_book_list,item_book_add,item_book_query;
menu_book=new Menu("图书管理");
item_book_list = new MenuItem("图书信息列表");
item_book_list.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
mainPanel.removeAll();
mainPanel.add(new BookListPanel(mainPanel));
}
});
menu_book.add(item_book_list);
item_book_add = new MenuItem("添加图书信息");
item_book_add.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
mainPanel.removeAll();
mainPanel.add(new BookAddPanel(mainPanel));
}
});
menu_book.add(item_book_add);
item_book_query = new MenuItem("查询图书信息");
item_book_query.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
mainPanel.removeAll();
mainPanel.add(new BookQueryPanel(mainPanel));
}
});
menu_book.add(item_book_query);
//mainBar.add(menu_book);
MenuItem item_in_list,item_in_add;
menu_in=new Menu("进单管理");
item_in_list=new MenuItem("进单信息列表");
item_in_list.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
mainPanel.removeAll();
mainPanel.add(new InListPanel(mainPanel));
}
});
menu_in.add(item_in_list);
item_in_add=new MenuItem("添加进单信息");
item_in_add.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
}
});
menu_in.add(item_in_add);
//mainBar.add(menu_in);
MenuItem item_out_list,item_out_add;
menu_out=new Menu("出货管理");
item_out_list=new MenuItem("出单信息列表");
item_out_list.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
}
});
menu_out.add(item_out_list);
item_out_add=new MenuItem("添加出单信息");
item_out_add.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
}
});
menu_out.add(item_out_add);
//mainBar.add(menu_out);
MenuItem item_stock_list,item_stock_query;
menu_stock=new Menu("库存管理");
item_stock_list=new MenuItem("库存信息列表");
item_stock_list.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
mainPanel.removeAll();
mainPanel.add(new StockListPanel(mainPanel));
}
});
menu_stock.add(item_stock_list);
item_stock_query=new MenuItem("库存信息查询");
item_stock_query.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
mainPanel.removeAll();
mainPanel.add(new StockQueryPanel(mainPanel));
}
});
menu_stock.add(item_stock_query);
//mainBar.add(menu_stock);
}
private class MyListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
if(e.getSource() == item_user_list){
mainPanel.removeAll();
mainPanel.add(new UserListPanel(mainPanel));
}else if(e.getSource() == item_user_add){
mainPanel.removeAll();
mainPanel.add(new UserAddPanel(mainPanel));
}else if(e.getSource() == item_user_query){
mainPanel.removeAll();
mainPanel.add(new UserQueryPanel(mainPanel));
}
}
}
}
- 1
- 2
- 3
前往页