示例#1
0
  void jbInit() throws Exception {
    panel1.setLayout(borderLayout1);
    panel2.setBackground(Color.yellow);
    panel2.setLayout(borderLayout2);
    ButtonOK.setLabel("OK");
    ButtonOK.addMouseListener(
        new java.awt.event.MouseAdapter() {

          public void mouseClicked(MouseEvent e) {
            ButtonOK_mouseClicked(e);
          }
        });

    String s1 = CallingApp.MotherApplet.GetName();

    textArea1.setBackground(SystemColor.control);
    textArea1.setEditable(false);

    panel1.add(panel2, BorderLayout.CENTER);
    panel2.add(textArea1, BorderLayout.CENTER);
    panel1.add(panel3, BorderLayout.SOUTH);
    panel3.add(ButtonOK, null);
    String s =
        s1
            + " v:"
            + CallingApp.MotherApplet.GetVersionNum()
            + "\n"
            + CallingApp.MotherApplet.GetInfos();
    textArea1.setText(s);
  }
示例#2
0
 /** Creates new HelpBox */
 public HelpBox() {
   super(new Frame(), " Help ", false);
   this.setBackground(Color.white);
   this.setLayout(new BorderLayout());
   helpTextArea = new TextArea();
   helpTextArea.setEditable(false);
   // fill the help box
   helpTextArea.append(
       "National Institute of Standards and Technology\n"
           + "========================================\n"
           + "\n"
           + "NIST-SIP Trace viewer 1.1\n"
           + "========================================\n"
           + "\n"
           + "\n"
           + " Hit refresh  to get new trace data from the proxy. \n"
           + "If no traces appear at all, you should check if the proxy is started.\n"
           + "Once some SIP sessions are available, you can click directly on \n"
           + "an arrow representing a SIP message of your \n"
           + "choice, and see the text of the chosen SIP message. \n"
           + "If any small yellow bubbles appear on the top right of the SIP message, \n"
           + "you can click on it and see some extra informations logged by the proxy.\n"
           + "\n"
           + "\n"
           + "If you experience any problems please contact:\n"
           + "[email protected]\n"
           + "\n");
   ok = new Button(" Ok ");
   ok.setBackground(Color.lightGray);
   ok.setForeground(Color.black);
   this.add(helpTextArea, BorderLayout.CENTER);
   this.add(ok, BorderLayout.SOUTH);
   ok.addMouseListener(
       new MouseAdapter() {
         @Override
         public void mouseClicked(MouseEvent e) {
           setVisible(false);
         }
       });
   this.addWindowListener(
       new WindowAdapter() {
         @Override
         public void windowClosing(WindowEvent e) {
           setVisible(false);
         }
       });
   // width, height
   this.setSize(400, 400);
 }
 public void start() {
   Button b = new Button("Press me");
   b.addMouseListener(
       new MouseAdapter() {
         public void mousePressed(MouseEvent e) {
           Sysout.println("Event occured : " + e);
           Sysout.println("The event time is : " + (new Date(e.getWhen())));
           Sysout.println("The system time is : " + (new Date()));
         }
       });
   add(b);
   setSize(200, 200);
   setVisible(true);
   validate();
 } // start()
示例#4
0
  OuterEventDemo(String s) {
    f = new Frame(s);
    f.addWindowListener(new WindowsEventListner());
    b = new Button("OK");
    b1 = new Button("CANCEL");
    b.setBounds(20, 100, 40, 40);
    b1.setBounds(20, 180, 40, 40);
    f.add(b);
    f.add(b1);

    b.addMouseListener(new MouseEventListener(this));
    b1.addMouseListener(new MouseEventListener(this));
    Outer o = new Outer(this);
    b.addActionListener(o);
    b1.addActionListener(o);

    tf = new TextField();
    tf.setBounds(20, 40, 100, 40);
    f.add(tf);
    tf.addKeyListener(new KeyEventListener());
    f.setLayout(null);
    f.setSize(400, 400);
    f.setVisible(true);
  }
示例#5
0
  void showWarning(Frame frame, String warning) {
    warningDialog = new Dialog(frame, "警告", true);
    warningDialog.setSize(200, 100);
    warningDialog.setLayout(new FlowLayout());
    warningDialog.setResizable(false);
    warningDialog.setLocationRelativeTo(frame);

    warningText = new Label(warning);
    warningButton = new Button("确认");

    warningDialog.add(warningText);
    warningDialog.add(warningButton);

    warningDialog.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            warningDialog.setVisible(false);
            warningDialog.dispose();
          }
        });

    warningButton.addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            int keyCode = e.getKeyCode();

            if (keyCode == KeyEvent.VK_ENTER) {
              warningDialog.setVisible(false);
              warningDialog.dispose();
            }
          }
        });

    warningButton.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            warningDialog.setVisible(false);
            warningDialog.dispose();
          }
        });

    warningDialog.setVisible(true);
  }
示例#6
0
  void addEvent() {
    mainFrame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });

    addressTextField.addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            int keyCode = e.getKeyCode();

            if (keyCode == KeyEvent.VK_ENTER) {
              showContent();
            }
          }
        });

    gotoButton.addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            int keyCode = e.getKeyCode();

            if (keyCode == KeyEvent.VK_ENTER) {
              showContent();
            }
          }
        });

    gotoButton.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            showContent();
          }
        });
  }
示例#7
0
  public MyFrame() {
    super("My Dialer");

    GridLayout gl = new GridLayout(7, 1, 2, 2);
    setLayout(gl);

    Panel displayPanel = new Panel();
    Panel padPanel = new Panel();
    Panel padPanel1 = new Panel();
    Panel padPanel2 = new Panel();
    Panel padPanel3 = new Panel();
    Panel padPanel4 = new Panel();
    Panel butPanel = new Panel();
    Panel dialingPanel = new Panel();

    tfPhoneNumber = new TextField(20);
    displayPanel.add(tfPhoneNumber);
    //        padPanel.setLayout(new GridLayout(4,3,2,2));

    int i;
    for (i = 0; i < 9; i++) {
      dialPad[i] = new Button(Integer.toString(i + 1));
    }
    dialPad[9] = new Button("*");
    dialPad[10] = new Button("0");
    dialPad[11] = new Button("#");

    MyMouseAdapter ma = new MyMouseAdapter();
    for (i = 0; i < 12; i++) {
      dialPad[i].setForeground(Color.blue);
      dialPad[i].addMouseListener(ma);
      dialPad[i].setPreferredSize(new Dimension(25, 25));
      //	    dialPad[i].setSize(35,35);
      //	    padPanel.add(dialPad[i]);
    }

    // Try flow layout as grid layout does not give set button size.
    for (i = 0; i < 3; i++) {
      padPanel1.add(dialPad[i]);
    }

    for (i = 3; i < 6; i++) {
      padPanel2.add(dialPad[i]);
    }

    for (i = 6; i < 9; i++) {
      padPanel3.add(dialPad[i]);
    }
    for (i = 9; i < 12; i++) {
      padPanel4.add(dialPad[i]);
    }

    tfDialing = new TextField(20);
    dialingPanel.add(tfDialing);
    dialButton = new Button("Dial");
    cancelButton = new Button("Cancel/Erase");
    tfDialing.setEditable(false);
    dialButton.setSize(40, 20);
    cancelButton.setSize(40, 20);
    dialButton.addMouseListener(ma);
    dialButton.setForeground(Color.blue);
    cancelButton.setForeground(Color.blue);
    cancelButton.addMouseListener(ma);
    butPanel.add(dialButton);
    butPanel.add(cancelButton);

    displayPanel.setSize(250, 40);
    padPanel1.setSize(250, 40);
    padPanel2.setSize(180, 40);
    padPanel3.setSize(180, 40);
    padPanel4.setSize(180, 40);
    butPanel.setSize(250, 25);
    dialingPanel.setSize(250, 20);

    // Add Panels to Frame
    add(displayPanel);
    // add(padPanel);
    add(padPanel1);
    add(padPanel2);
    add(padPanel3);
    add(padPanel4);
    add(butPanel);
    add(dialingPanel);

    //        MyMouseAdapter ma = new MyMouseAdapter();
    //        button.addMouseListener(ma);

    setSize(250, 250);
    setVisible(true);
  }