Ejemplo n.º 1
0
 Panel2(web main) {
   setLayout(new GridLayout(1, 2));
   main.par = new TextArea();
   main.par.setEditable(false);
   main.par.setBackground(Color.black);
   main.par.setForeground(Color.lightGray);
   add(main.par);
   button = new Button("start");
   button.setBackground(Color.black);
   button.setForeground(Color.blue);
   button.setFont(new Font("Default", Font.PLAIN, 32));
   add(button);
   button.addActionListener(main);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 3
0
 private void initcomp() {
   this.setLayout(null);
   this.setLocation(249, 135);
   this.setSize(300, 400);
   this.addWindowListener(
       new WindowAdapter() {
         public void windowClosing(WindowEvent we) {
           System.exit(0);
         }
       });
   this.add(btn1);
   this.add(btn2);
   this.add(btn3);
   btn1.setBounds(50, 50, 50, 100);
   btn2.setBounds(200, 50, 50, 100);
   btn3.setBounds(50, 200, 200, 50);
   btn1.setBackground(Color.CYAN);
   btn2.setBackground(Color.BLACK);
   btn2.setForeground(Color.WHITE);
   btn3.setBackground(Color.YELLOW);
   this.setTitle(Integer.toString(i));
   btn1.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent arg0) {
           // TODO Auto-generated method stub
           i++;
           ct();
         }
       });
   btn2.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent arg0) {
           // TODO Auto-generated method stub
           i--;
           ct();
         }
       });
   btn3.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent arg0) {
           // TODO Auto-generated method stub
           System.exit(0);
         }
       });
 }
Ejemplo n.º 4
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);
  }