⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainframe.java

📁 java在线商店的源代码。编写十分规范的哦
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
  public void fileExit_actionPerformed(ActionEvent e) {
    System.exit(0);
  }

  /**
   * Window closing event. Close the applcation.
   *
   * @param e WindowEvent
   * return  void
   */
  public void this_windowClosing(WindowEvent e) {
    System.exit(0);
  }

  /**
   * Menu Help | About action performed event handler. Show the About Box for
   * the application.
   *
   * @param e ActionEvent
   * return  void
   */
  public void helpAbout_actionPerformed(ActionEvent e) {
    MainFrame_AboutBox dlg = new MainFrame_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.show();
  }

  /**
   * When the Orders button is clicked, show the Orders popup menu.
   *
   * @param e ActionEvent
   * return  void
   */
  void btnOrders_actionPerformed(java.awt.event.ActionEvent e) {
    jPanel2.add(pumOrder);
    pumOrder.show(jPanel2, btnOrders.getSize().width, btnOrders.getLocation().y);
  }

  /**
   * When the Customers button is clicked, show the Customers popup menu.
   *
   * @param e ActionEvent
   * return  void
   */
  void btnCustomers_actionPerformed(java.awt.event.ActionEvent e) {
    jPanel2.add(pumCustomer);
    pumCustomer.show(jPanel2, btnCustomers.getSize().width, btnCustomers.getLocation().y);
  }

  /**
   * When the Products button is clicked, show the Products popup menu.
   *
   * @param e ActionEvent
   * return  void
   */
  void btnProducts_actionPerformed(java.awt.event.ActionEvent e) {
    jPanel2.add(pumProduct);
    pumProduct.show(jPanel2, btnProducts.getSize().width, btnProducts.getLocation().y);
  }

  /**
   * When the Categories button is clicked, show the Categories form. Note:
   * There is no Categories popup menu.
   *
   * @param e ActionEvent
   * return  void
   */
  void btnCategories_actionPerformed(java.awt.event.ActionEvent e) {
    JFrame frame = CategoryFrame.getCategoryFrame();
    CliffhangerApplication.showCenteredWindow(frame, false);
  }

  /**
   * When the Exit button is clicked, close the application.
   *
   * @param e ActionEvent
   * return  void
   */
  void btnExit_actionPerformed(java.awt.event.ActionEvent e) {
    System.exit(0);
  }

  /**
   * When the New Order menu item is clicked, show the Order Entry form, And
   * insert a new Order record.
   *
   * @param e ActionEvent
   * return  void
   */
  void pumNewOrder_actionPerformed(java.awt.event.ActionEvent e) {
    OrderEntryFrame frame = OrderEntryFrame.getOrderEntryFrame();
    CliffhangerApplication.showCenteredWindow(frame, false);
    frame.newOrder();
  }

  /**
   * When the Find Order menu is clicked, show the Find Order form.
   *
   * @param e ActionEvent
   * return  void
   */
  void pumFindOrder_actionPerformed(java.awt.event.ActionEvent e) {
    JFrame frame = OrderFindFrame.getOrderFindFrame();
    CliffhangerApplication.showCenteredWindow(frame, false);
  }

  /**
   * When the New Customer menu item is clicked, show the Customer form, And
   * insert a new customer record.
   *
   * @param e ActionEvent
   * return  void
   */
  void pumNewCustomer_actionPerformed(java.awt.event.ActionEvent e) {
    CustomerFrame frame = CustomerFrame.getCustomerFrame();
    CliffhangerApplication.showCenteredWindow(frame, false);
    frame.newCustomer();
   }

  /**
   * When the Find Customer menu is clicked, show the Find Customer form.
   *
   * @param e ActionEvent
   * return  void
   */
  void pumFindCustomer_actionPerformed(java.awt.event.ActionEvent e) {
    JFrame frame = CustomerFindFrame.getCustomerFindFrame();
    CliffhangerApplication.showCenteredWindow(frame, false);
  }

  /**
   * When the New Product menu item is clicked, show the Product form, And
   * insert a new Product record.
   *
   * @param e ActionEvent
   * return  void
   */
  void pumNewProduct_actionPerformed(java.awt.event.ActionEvent e) {
    ProductFrame frame = ProductFrame.getProductFrame();
    CliffhangerApplication.showCenteredWindow(frame, false);
    frame.newProduct();
  }

  /**
   * When the Find Product menu is clicked, show the Find Product form.
   *
   * @param e ActionEvent
   * return  void
   */
  void pumFindProduct_actionPerformed(java.awt.event.ActionEvent e) {
    JFrame frame = ProductFindFrame.getProductFindFrame();
    CliffhangerApplication.showCenteredWindow(frame, false);
  }

  //.....................................................
  /**
   * The following methods are event handlers for showing a hint in the
   * statusBar when the user places the mouse over the buttons on the Main
   * Frame.
   *
   * @param e MouseEvent
   * return  void
   */
  void btnOrders_mouseEntered(MouseEvent e) {
    statusBar.setText(res.getString("MF_Customer_Orders"));
  }

  void btnOrders_mouseExited(MouseEvent e) {
    statusBar.setText(" ");
  }

  void btnCustomers_mouseEntered(MouseEvent e) {
    statusBar.setText(res.getString("MF_Customer_Records"));
  }

  void btnCustomers_mouseExited(MouseEvent e) {
    statusBar.setText(" ");
  }

  void btnProducts_mouseEntered(MouseEvent e) {
    statusBar.setText(res.getString("MF_Cliffhanger_Products"));
  }

  void btnProducts_mouseExited(MouseEvent e) {
    statusBar.setText(" ");
  }

  void btnCategories_mouseEntered(MouseEvent e) {
    statusBar.setText(res.getString("MF_Product_Categories"));
  }

  void btnCategories_mouseExited(MouseEvent e) {
    statusBar.setText(" ");
  }

  void btnExit_mouseEntered(MouseEvent e) {
    statusBar.setText(res.getString("MF_Exit_Cliffhanger"));
  }

  void btnExit_mouseExited(MouseEvent e) {
    statusBar.setText(" ");
  }
  //.....................................................

}

/**
 * MainFrame_AboutBox is the About Box dialog for the Cliffhanger Application.
 * This class was originally generated by the Application Wizard.
 */
class MainFrame_AboutBox extends JDialog {
  JPanel contentPane;
  JPanel jPanel1 = new JPanel();
  JPanel jPanel2 = new JPanel();
  JPanel jPanel3 = new JPanel();
  JPanel jPanel4 = new JPanel();
  JButton jButton1 = new JButton();
  JLabel imageLabel1 = new JLabel();
  JLabel jLabel1 = new JLabel();
  JLabel jLabel2 = new JLabel();
  JLabel jLabel3 = new JLabel();
  JLabel jLabel4 = new JLabel();
  BorderLayout borderLayout1 = new BorderLayout();
  BorderLayout borderLayout2 = new BorderLayout();
  GridLayout gridLayout1 = new GridLayout();
  ResourceBundle res = java.util.ResourceBundle.getBundle("com.borland.samples.orderentry.Res");

  String product = res.getString("AB_product");
  String version = res.getString("AB_version");
  String copyright = res.getString("AB_copyright");
  String comments = res.getString("AB_comments");

  public MainFrame_AboutBox(Frame parent) {
    super(parent);
    try {
      jbInit();
    }
    catch (Exception e) {
      e.printStackTrace();
    };
    pack();
  }

  void jbInit() throws Exception{
    contentPane = (JPanel) this.getContentPane();
    contentPane.setLayout(borderLayout1);
    this.setTitle(res.getString("MF_About"));
    this.setResizable(false);
    contentPane.add(jPanel1, null);
    jPanel1.setLayout(borderLayout2);
    jPanel3.add(imageLabel1, null);
    jPanel3.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    jPanel1.add(jPanel3, BorderLayout.WEST);
    gridLayout1.setRows(4);
    gridLayout1.setColumns(1);
    jLabel1.setText(product);
    jLabel1.setHorizontalTextPosition(SwingConstants.CENTER);
    jLabel2.setText(version);
    jLabel2.setHorizontalTextPosition(SwingConstants.CENTER);
    jLabel3.setText(copyright);
    jLabel3.setHorizontalTextPosition(SwingConstants.CENTER);
    jLabel4.setText(comments);
    jLabel4.setHorizontalTextPosition(SwingConstants.CENTER);
    jPanel4.setLayout(gridLayout1);
    jPanel4.add(jLabel1, null);
    jPanel4.add(jLabel2, null);
    jPanel4.add(jLabel3, null);
    jPanel4.add(jLabel4, null);
    jPanel4.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    jPanel1.add(jPanel4, BorderLayout.CENTER);
    jButton1.setText(res.getString("MF_OK"));
    jButton1.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        jButton1_actionPerformed(e);
      }
    });
    jPanel2.add(jButton1, null);
    jPanel1.add(jPanel2, BorderLayout.SOUTH);
    jPanel1.add(jPanel3, BorderLayout.NORTH);
    imageLabel1.setHorizontalAlignment(SwingConstants.CENTER);
    imageLabel1.setVerticalAlignment(SwingConstants.CENTER);
    imageLabel1.setIcon(new ImageIcon(this.getClass().getResource("images/logo_sml.gif")));
    pack();
  }

  public void jButton1_actionPerformed(ActionEvent e) {
    if(e.getSource() == jButton1) {
      setVisible(false);
      dispose();
    }
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -