?? interface.java
字號:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package book_booking;import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.io.*;//import java.util.Hashtable;import java.sql.*;public class Interface extends JFrame implements ActionListener{ Addbooks 書籍信息錄入=null; Modifybooks 書籍信息修改=null; BooksQuery 書籍信息查詢=null; BookingListQuery 錄入采購信息=null; Delete 刪除書籍及采購=null; PrintBooking 打印采購單信息=null;// Imagecanvas canvas=null; JMenuBar bar; JMenu fileMenu; JMenuItem 錄入,修改,錄入采購單,查詢書籍,刪除信息,打印; Container con=null; CardLayout card=null; JLabel label=null; JPanel pCenter; public Interface() { // canvas=new Imagecanvas();// this.add(canvas,"Center"); 錄入=new JMenuItem("錄入書籍基本信息"); 修改=new JMenuItem("修改書籍基本信息"); 查詢書籍=new JMenuItem("查詢書籍基本信息"); 錄入采購單=new JMenuItem("錄入采購基本信息"); 刪除信息=new JMenuItem("刪除書籍及采購基本信息"); 打印=new JMenuItem("打印采購單"); bar=new JMenuBar(); fileMenu=new JMenu("菜單選項"); fileMenu.add(錄入); fileMenu.add(修改); fileMenu.add(查詢書籍); fileMenu.add(錄入采購單); fileMenu.add(刪除信息); fileMenu.add(打印); bar.add(fileMenu); setJMenuBar(bar); label=new JLabel("歡迎使用書店采購管理系統(tǒng)",JLabel.CENTER); label.setFont(new Font("TimesRoman",Font.BOLD,24)); label.setForeground(Color.red); 錄入.addActionListener(this); 修改.addActionListener(this); 錄入采購單.addActionListener(this); 查詢書籍.addActionListener(this); 刪除信息.addActionListener(this); 打印.addActionListener(this); card=new CardLayout(); con=getContentPane(); pCenter=new JPanel(); pCenter.setLayout(card); 書籍信息錄入=new Addbooks(); 書籍信息修改=new Modifybooks(); 錄入采購信息=new BookingListQuery(); 書籍信息查詢=new BooksQuery(); 刪除書籍及采購=new Delete(); 打印采購單信息=new PrintBooking(); pCenter.add("歡迎語界面",label); pCenter.add("錄入界面",書籍信息錄入); pCenter.add("修改界面",書籍信息修改); pCenter.add("查詢書籍界面",書籍信息查詢); pCenter.add("錄入采購單界面",錄入采購信息); pCenter.add("刪除界面",刪除書籍及采購); pCenter.add("打印界面",打印采購單信息); con.add(pCenter,BorderLayout.CENTER); con.validate(); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); setVisible(true); setBounds(300,200,420,380); validate(); } // @Override// public void paintComponent(Graphics g)// { // ImageIcon imageIcon = new ImageIcon(getClass().getResource("/book_booking/image/book.jpg"));// Image image = imageIcon.getImage();// // g.drawImage(image,0,0,image.getWidth(this),image.getHeight(this),this); // } public void actionPerformed(ActionEvent e) { if(e.getSource()==錄入) { card.show(pCenter,"錄入界面"); } else if(e.getSource()==修改) { card.show(pCenter,"修改界面"); } else if(e.getSource()==查詢書籍) { card.show(pCenter,"查詢書籍界面"); } else if(e.getSource()==錄入采購單) { card.show(pCenter,"錄入采購單界面"); } else if(e.getSource()==刪除信息) { card.show(pCenter,"刪除界面"); } else if(e.getSource()==打印) { card.show(pCenter,"打印界面"); } } }
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -