?? bookmanagermain.java~1~
字號(hào):
package bookmanager;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 BookManagerMain extends JFrame { JPanel contentPane; JMenuBar jMenuBar1 = new JMenuBar(); JMenu jMenuFile = new JMenu(); JMenuItem jMenuFileExit = new JMenuItem(); JMenu jMenuHelp = new JMenu(); JMenuItem jMenuHelpAbout = new JMenuItem(); BorderLayout borderLayout1 = new BorderLayout(); JMenuItem jMenuItem1 = new JMenuItem(); JMenuItem jMenuItem2 = new JMenuItem(); JMenu jMenu1 = new JMenu(); JMenuItem jMenuItem3 = new JMenuItem(); JMenuItem jMenuItem4 = new JMenuItem(); //Construct the frame public BookManagerMain() { 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.setSize(new Dimension(485, 327)); this.setTitle("Frame Title"); jMenuFile.setText("book manager"); jMenuFileExit.setText("book in"); jMenuFileExit.addActionListener(new BookManagerMain_jMenuFileExit_ActionAdapter(this)); jMenuHelp.setText("borrow"); jMenuHelpAbout.setText("borrow "); jMenuHelpAbout.addActionListener(new BookManagerMain_jMenuHelpAbout_ActionAdapter(this)); jMenuItem1.setText("exit"); jMenuItem1.addActionListener(new BookManagerMain_jMenuItem1_actionAdapter(this)); jMenuItem2.setText("book update"); jMenu1.setToolTipText(""); jMenu1.setText("help"); jMenuItem3.setText("borrow history"); jMenuItem4.setText("about"); jMenuItem4.addActionListener(new BookManagerMain_jMenuItem4_actionAdapter(this)); jMenuFile.add(jMenuFileExit); jMenuFile.add(jMenuItem2); jMenuFile.add(jMenuItem1); jMenuHelp.add(jMenuHelpAbout); jMenuHelp.add(jMenuItem3); jMenuBar1.add(jMenuFile); jMenuBar1.add(jMenuHelp); jMenuBar1.add(jMenu1); jMenu1.add(jMenuItem4); this.setJMenuBar(jMenuBar1); } //File | Exit action performed public void jMenuFileExit_actionPerformed(ActionEvent e) { } //Help | About action performed public void jMenuHelpAbout_actionPerformed(ActionEvent e) { } //Overridden so we can exit when window is closed protected void processWindowEvent(WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { jMenuFileExit_actionPerformed(null); } } void jMenuItem4_actionPerformed(ActionEvent e) { BookManagerMain_AboutBox dlg = new BookManagerMain_AboutBox(this); 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 jMenuItem1_actionPerformed(ActionEvent e) { dispose(); }}class BookManagerMain_jMenuFileExit_ActionAdapter implements ActionListener { BookManagerMain adaptee; BookManagerMain_jMenuFileExit_ActionAdapter(BookManagerMain adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jMenuFileExit_actionPerformed(e); }}class BookManagerMain_jMenuHelpAbout_ActionAdapter implements ActionListener { BookManagerMain adaptee; BookManagerMain_jMenuHelpAbout_ActionAdapter(BookManagerMain adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jMenuHelpAbout_actionPerformed(e); }}class BookManagerMain_jMenuItem4_actionAdapter implements java.awt.event.ActionListener { BookManagerMain adaptee; BookManagerMain_jMenuItem4_actionAdapter(BookManagerMain adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jMenuItem4_actionPerformed(e); }}class BookManagerMain_jMenuItem1_actionAdapter implements java.awt.event.ActionListener { BookManagerMain adaptee; BookManagerMain_jMenuItem1_actionAdapter(BookManagerMain adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jMenuItem1_actionPerformed(e); }}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -