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

📄 checkin.java

📁 Java经典例程 从外国一大学计算机教授出版物下载的代码 经典
💻 JAVA
字号:
import java.awt.*;
import java.applet.*;
import java.awt.event.*;

public class Checkin extends Applet implements ActionListener {

  /* The Check in Message Applet   by L Botha and J Bishop
   * ===========================   Java 1.1 January 1998
   * receives the fields for the check in
   * message, constructs it and sends it
   * on to the rmi server which must be set
   * running first.
   */

  private Button sendButton;
  private TextField flight, to;
  private String message;

  public void init() {
    // the color is Java Gently's special orange, specified
    // as a hexadecimal number, taken from the HTML

    setBackground(new Color(0xF1D7BE));
    setLayout(new BorderLayout());

    add("North",new Label("CHECK IN ANNOUNCEMENT",Label.CENTER));

    Panel p = new Panel();
      // We use Grid Bag so that the labels and fields can be
      // be different sizes

      GridBagLayout layout = new GridBagLayout();
      p.setLayout(layout);
      GridBagConstraints c = new GridBagConstraints();
      c.gridwidth = 1; c.gridheight = 1;
      Label flightLabel = new Label("Flight number");
        c.gridx = 0; c.gridy = 0;
        layout.setConstraints(flightLabel, c);
        p.add(flightLabel);
      Label toLabel = new Label("Destination");
        c.gridx = 0; c.gridy = 1;
        layout.setConstraints(toLabel, c);
        p.add(toLabel);
      flight = new TextField("", 20);
        flight.addActionListener(this);
        c.gridx = 1; c.gridy = 0;
        layout.setConstraints(flight, c);
        p.add(flight);
      to = new TextField("", 20);
        to.addActionListener(this);
        c.gridx = 1; c.gridy = 1;
        layout.setConstraints(to, c);
        p.add(to);

      add("Center",p);

    Panel q = new Panel();
      sendButton = new Button("Send");
        sendButton.addActionListener(this);
        q.add(sendButton);
        q.add(new Label("then click Continue"));
    add("South",q);
  }

  public void actionPerformed(ActionEvent e) {
    Object source = e.getSource();
    if (source == sendButton) {
      message =
        "Will all passengers not yet in possession of "
      + "boarding passes for flight " + flight.getText() + " to "
      + to.getText() + " please leave the queue and move "
      + "directly to check-in 35 or 36.";
      AnnouncerClient.sendMessage(message);
      flight.setText("");
      to.setText("");
    }
  }
}




⌨️ 快捷键说明

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