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

📄 catalogsubmission.java

📁 Java程序设计技巧与开发实例附书源代码。
💻 JAVA
字号:

import java.awt.*;
import java.awt.event.*;

public class CatalogSubmission
    extends Frame
    implements ActionListener
{
   private Catalog owner = null;
   private TextField name = new TextField();
   private TextArea address = new TextArea(3, 20);
   private TextField credit = new TextField();
   private TextArea orders = new TextArea(6, 30);
   private CatalogOrder theBill = null;
   private Button submit = new Button("Submit Order");
   private Button cancel = new Button("Cancel Order");
   private Label status = new Label("Enter personal and mailing info");
   public CatalogSubmission(Catalog _owner, CatalogOrder _theBill)
   {
      super("Submit your Order");
      owner = _owner;
      theBill = _theBill;
      Color color = new Color(255, 255, 200);
      Panel buttons = new Panel();
      buttons.setLayout(new FlowLayout());
      buttons.add(submit);
      submit.addActionListener(this);
      buttons.add(cancel);
      cancel.addActionListener(this);
      Panel cInfo = new Panel();
      cInfo.setLayout(new GridLayout(2, 2));
      cInfo.add(new Label("Full Name:"));
      cInfo.add(name);
      cInfo.add(new Label("Credit Card: "));
      cInfo.add(credit);
      Panel pInfo = new Panel();
      pInfo.setLayout(new BorderLayout());
      pInfo.add("West", new PanelBox(cInfo, "Personal Info", color));
      pInfo.add("East", new PanelBox(address, "Mailing Address", color));
      Panel oInfo = new Panel();
      oInfo.setLayout(new BorderLayout());
      oInfo.add("Center", new PanelBox(orders, "Your order: ", color));
      oInfo.add("South", new PanelBox(status, "Status:", color));
      setLayout(new BorderLayout());
      add("North", pInfo);
      add("Center", oInfo);
      add("South", buttons);
      orders.setText(theBill.toString());
      orders.setEditable(false);
      validate();
      pack();
      setVisible(true);
      submit.setEnabled(true);
      addWindowListener(new WindowAdapter()
      {
         public void windowClosing(WindowEvent we)
         {
            owner.closeSubmission();
         }
      });
   }

   public void actionPerformed(ActionEvent ae)
   {
      if (ae.getSource() == cancel)
      {
         owner.closeSubmission();
      }
      else if (ae.getSource() == submit)
      {
         theBill.setInfo(name.getText(), credit.getText(),
                         address.getText());
         if (theBill.isComplete())
         {
            status.setText("NOT SUBMITTED: feature not implemented.");
         }
         else
         {
            status.setText("NOT SUBMITTED: incomplete information.");
         }
      }
   }
}

⌨️ 快捷键说明

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