示例#1
52
 /**
  * Show the given message in a dialog box or independent window, depending on whether the source
  * component is contained in a Frame or not.
  *
  * @param c The Controller that calls this method, or null if it is not called by a Controller.
  *     (The Controller, if any, will be notified when the error message is cleared.)
  * @param message The message to display.
  */
 public void setErrorMessage(Controller c, String message) {
   if (popup != null) clearErrorMessage();
   if (message == null) return;
   errorSource = c;
   errorMessage = message;
   Component parent = source;
   while (parent != null && !(parent instanceof Frame)) parent = parent.getParent();
   if (parent != null) popup = new Dialog((Frame) parent, "Error Message", true); // modal dialog
   else popup = new Frame("Error Message"); // independent window
   popup.setBackground(Color.white);
   popup.add(new MC(message), BorderLayout.CENTER);
   Panel buttonBar = new Panel();
   buttonBar.setLayout(new FlowLayout(FlowLayout.RIGHT, 10, 10));
   Button OK = new Button("    OK    ");
   OK.addActionListener(this);
   buttonBar.add(OK);
   popup.add(buttonBar, BorderLayout.SOUTH);
   popup.pack();
   if (parent == null) popup.setLocation(100, 80);
   else popup.setLocation(parent.getLocation().x + 50, parent.getLocation().y + 30);
   popup.addWindowListener(
       new WindowAdapter() {
         public void windowClosing(WindowEvent evt) {
           popup.dispose();
         }
       });
   popup.show(); // make the dialog visible.
 }
  private void deathStuff() {
    float rec = readRecord();

    if (rec < points) {
      try {
        textOutput();
      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }

    record.setText("The record is: " + (int) rec);
    add(record);
    add(score);
    add(tips);
    add(restart);
    add(reset);
    reset.setLabel("Reset Record");
    reset.addActionListener(this);
    reset.setSize(100, 20);
    reset.setLocation(300, 10);
    restart.addActionListener(this);
    restart.setSize(100, 20);
    restart.setLocation(150, 200);

    add(exit);
    exit.addActionListener(this);
    exit.setSize(160, 20);
    exit.setLocation(120, 250);
  }
  @Override
  public void paint(Graphics g) {
    g.setColor(Color.white);
    g.fillRect(0, 0, getWidth(), getHeight());
    if (self == null) {
      self = new Self(1000, maxX, maxY);
    }

    drawCells(g, self);
    if (testing.isView()) {
      g.setColor(Color.white);
      g.fillRect(0, 0, getWidth(), getHeight());

      drawCells(g, antigen);
      drawCells(g, testing);
      button.setLabel(testing.printAccuracy(antigen));
      // drawStepCells(g);
      antigen = null;
      testing.setView(false);
    }

    if (antigen != null) {
      if (antigen.isLastView()) {
        drawCells(g, antigen);
        antigen.setLastView(false);
        testing.setView(true);
        button.setLabel("Calculating Accuracy");
        testing.countAccuracy(antigen);
        button.setLabel("Viewing Accuracy");
        // antigen = null;
      } else {
        drawStepCells(g);
      }
    }
  }
示例#4
0
文件: Binder.java 项目: vitlav/siu
  public void ready(String name, PrivateKey unusedPrivateKey, X509Certificate certificate) {
    String status;
    try {
      vaadin.updateVariable("cert", printBase64Binary(certificate.getEncoded()));
      status = "Готово.";
    } catch (CertificateEncodingException e) {
      status = "Ошибка.";
    }

    ui.removeAll();
    ui.add(new Label(name), BorderLayout.PAGE_START);
    ui.add(new Label(status), BorderLayout.CENTER);

    Button cancel = new Button("Отменить");
    cancel.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            loading();
          }
        });
    Panel buttons = new Panel(new BorderLayout(2, 2));
    buttons.add(cancel, BorderLayout.LINE_START);
    ui.add(buttons, BorderLayout.PAGE_END);
    refresh();
  }
 public Form() {
   Panel insertPanel = new Panel();
   Panel buttonsPanel = new Panel();
   Panel infoPanel = new Panel();
   Label referenceLabel = new Label("Nome");
   _name = new TextField(60);
   Label bibtexLabel = new Label("IST-ID");
   _istId = new TextField(60);
   _infoText = new Label("Por favor insira o texto!");
   insertPanel.setLayout(new GridLayout(5, 1));
   insertPanel.add(referenceLabel);
   insertPanel.add(_name);
   insertPanel.add(bibtexLabel);
   insertPanel.add(_istId);
   _addUser = new Button("Adicionar utilizador");
   _addUser.setActionCommand("AddCitation");
   _addUser.addActionListener(this);
   _writeXML = new Button("Write XML and Close");
   _writeXML.addActionListener(this);
   _writeXML.setActionCommand("WriteClose");
   buttonsPanel.add(_addUser);
   buttonsPanel.add(_writeXML);
   infoPanel.add(_infoText);
   add(infoPanel, BorderLayout.NORTH);
   add(insertPanel, BorderLayout.CENTER);
   add(buttonsPanel, BorderLayout.SOUTH);
 }
示例#6
0
  public void addClient() {
    client =
        new Canvas() {
          public void paint(Graphics g) {
            super.paint(g);
          }
        };
    client.setBackground(new Color(30, 220, 40));
    clientCont.add(client);
    clientCont.validate();
    final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    WindowIDProvider pid = (WindowIDProvider) acc.getPeer(client);
    log.fine("Added XEmbed server(Canvas) with X window ID " + pid.getWindow());
    Rectangle toFocusBounds = toFocus.getBounds();
    toFocusBounds.setLocation(toFocus.getLocationOnScreen());
    f.validate();

    // KDE doesn't accept clicks on title as activation - click below title
    Rectangle fbounds = f.getBounds();
    fbounds.y += f.getInsets().top;
    fbounds.height -= f.getInsets().top;

    Process proc =
        startClient(
            new Rectangle[] {
              fbounds,
              dummy.getBounds(),
              toFocusBounds,
              new Rectangle(b_modal.getLocationOnScreen(), b_modal.getSize()),
              new Rectangle(10, 130, 20, 20)
            },
            pid.getWindow());
    new ClientWatcher(client, proc, clientCont).start();
  }
示例#7
0
 public void init() {
   add(t);
   start.addActionListener(new StartL());
   add(start);
   onOff.addActionListener(new OnOffL());
   add(onOff);
 }
示例#8
0
  // 생성자
  public OuterEventClass() {
    InnerEventClass IEC;

    // Layout manager설정
    setLayout(new BorderLayout());
    // 윈도우 창 닫기 이벤트를 자기자신의 객체에 붙여버림
    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent we) {
            System.exit(0);
          }
        });

    but1 = new Button("왼쪽 버튼");
    but2 = new Button("아래쪽 버튼");
    txtA = new TextArea();

    // inner 클래스 인스턴스
    IEC = new InnerEventClass();

    // 버튼에 감지 기능 추가
    but1.addActionListener(IEC);
    but2.addActionListener(IEC);

    // 프레임에 버튼 추가
    add("North", but1);
    add("South", but2);
    add("Center", txtA);
  }
示例#9
0
 public void init() {
   frame = new Frame("PictureViewer");
   Panel pb = new Panel();
   Button select = new Button("choose pic");
   previous = new Button("previous");
   next = new Button("next");
   select.addActionListener(this);
   previous.addActionListener(this);
   next.addActionListener(this);
   pb.add(select);
   pb.add(previous);
   pb.add(next);
   mc = new MyCanvas();
   mc.setBackground(new Color(200, 210, 230));
   mc.addComponentListener(mc);
   frame.add(pb, "North");
   frame.add(mc, "Center");
   frame.setSize(360, 360);
   frame.setLocation(400, 200);
   frame.addWindowListener(
       new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
           System.exit(0);
         }
       });
   frame.setVisible(true);
   this.validateButton();
   filter = new MyFilter();
   fd_load = new FileDialog(frame, "Open file", FileDialog.LOAD);
   fd_load.setFilenameFilter(filter);
 }
示例#10
0
  PanelTest() {
    setLayout(new FlowLayout());

    p1 = new Panel();
    p2 = new Panel();
    b1 = new Button("패널2 보이기");
    b2 = new Button("패널2 안보이기");
    b3 = new Button("패널1 보이기");
    b4 = new Button("패널1 안보이기");

    p1.setBackground(Color.CYAN);
    p2.setBackground(Color.LIGHT_GRAY);

    p1.add(b1);
    p1.add(b2);
    p2.add(b3);
    p2.add(b4);

    add(p1);
    add(p2);

    b1.addActionListener(this);
    b2.addActionListener(this);
    b3.addActionListener(this);
    b4.addActionListener(this);

    setSize(400, 500);
    setVisible(true);
  }
示例#11
0
  public LayerLegend getLegend() {
    legend.show = showCB.isSelected();
    legend.border = borderCB.isSelected();
    legend.horizontal = horRB.isSelected();

    legend.showTitle = showTitleCB.isSelected();
    legend.border = borderCB.isSelected();
    legend.legendName = titleField.getText();
    legend.legendTitleColor = titleColorButton.getBackground();
    legend.legendTextColor = textColorButton.getBackground();
    legend.legendBorderColor = borderColorButton.getBackground();
    legend.legendFont =
        new Font(
            (String) fontNameCombo.getSelectedItem(),
            styleNumber((String) fontStyleCombo.getSelectedItem()),
            Integer.parseInt((String) fontSizeCombo.getSelectedItem()));

    // legend.layerNumber = Integer.parseInt(layerField.getText());
    try {
      legend.layerNumber = Integer.parseInt(layerField.getText());
    } catch (NumberFormatException ex) {
      JOptionPane.showMessageDialog(
          this,
          iPlug.get("JumpPrinter.Furniture.Message2") + ": " + layerField.getText(),
          iPlug.get("JumpPrinter.Error"),
          JOptionPane.ERROR_MESSAGE);
    }
    for (int i = 0; i < numItems; i++) {
      LegendElement item = legend.legendItems.elementAt(i);
      item.include = chooseCB[i].isSelected();
    }
    // legend.size = Integer.parseInt((String)sizeCombo.getSelectedItem());
    return legend;
  }
示例#12
0
 /**
  * Notify any DialogListeners of changes having occurred If a listener returns false, do not call
  * further listeners and disable the OK button and preview Checkbox (if it exists). For
  * PlugInFilters, this ensures that the PlugInFilterRunner, which listens as the last one, is not
  * called if the PlugInFilter has detected invalid parameters. Thus, unnecessary calling the
  * run(ip) method of the PlugInFilter for preview is avoided in that case.
  */
 private void notifyListeners(AWTEvent e) {
   if (dialogListeners == null) return;
   boolean everythingOk = true;
   for (int i = 0; everythingOk && i < dialogListeners.size(); i++)
     try {
       resetCounters();
       if (!((DialogListener) dialogListeners.elementAt(i)).dialogItemChanged(this, e))
         everythingOk = false;
     } // disable further listeners if false (invalid parameters) returned
     catch (Exception err) { // for exceptions, don't cover the input by a window but
       IJ.beep(); // show them at in the "Log"
       IJ.log(
           "ERROR: "
               + err
               + "\nin DialogListener of "
               + dialogListeners.elementAt(i)
               + "\nat "
               + (err.getStackTrace()[0])
               + "\nfrom "
               + (err.getStackTrace()[1])); // requires Java 1.4
     }
   boolean workaroundOSXbug = IJ.isMacOSX() && okay != null && !okay.isEnabled() && everythingOk;
   if (previewCheckbox != null) previewCheckbox.setEnabled(everythingOk);
   if (okay != null) okay.setEnabled(everythingOk);
   if (workaroundOSXbug) repaint(); // OSX 10.4 bug delays update of enabled until the next input
 }
示例#13
0
  /** Constructor to setup the GUI */
  public WindowEvent() {
    setLayout(new FlowLayout()); // "this" Frame sets to FlowLayout

    add(new Label("Counter")); // "this" Frame adds an anonymous Label

    tfCount = new TextField("0", 10); // allocate TextField
    tfCount.setEditable(false); // read-only
    add(tfCount); // "this" Frame adds tfCount

    Button btnCount = new Button("Count"); // declare and allocate a Button
    add(btnCount); // "this" Frame adds btnCount

    Button btnClose = new Button("Close");
    add(btnClose);

    btnClose.setActionCommand("CLOSE");
    btnClose.addActionListener(this);

    btnCount.addActionListener(this);
    // btnCount fires ActionEvent to its registered ActionEvent listener
    // btnCount adds "this" object as an ActionEvent listener

    addWindowListener(this);
    // "this" Fra e fires WindowEvent its registered WindowEvent listener
    // "this" Frame adds "this" object as a WindowEvent listener

    setTitle("WindowEvent Demo"); // "this" Frame sets title
    setSize(250, 100); // "this" Frame sets initial size
    setVisible(true); // "this" Frame shows
  }
示例#14
0
  public UserInfoDialog(Frame parent) {
    super(parent, "Input", true);
    setLayout(null);

    l.setFont(default_font);
    l.setSize(50, 30);
    l.setLocation(30, 50);

    name.setFont(default_font);
    name.setSize(150, 30);
    name.setLocation(90, 50);
    // name.selectAll();

    ok.setFont(default_font);
    ok.setSize(50, 30);
    ok.setLocation(30, 90);

    add(l);
    add(name);
    add(ok);
    ok.addActionListener(this);
    setSize(300, 150);

    Point my_loc = parent.getLocation();
    my_loc.x += 50;
    my_loc.y += 150;
    setLocation(my_loc);
    show();
  }
示例#15
0
  DomainPanel(DomainConnection connection) {
    _connection = connection;
    _useColor = System.getProperty("bw") == null;
    if (_useColor) {
      setBackground(Color.red);
    }
    setLayout(new BorderLayout());
    _leftPanel = new LeftPanel();
    _topLabel = new Label("Domain", Label.CENTER);
    _topLabel.setFont(new Font("fixed", Font.ITALIC, 18));
    add(_topLabel, "North");
    add(new BorderPanel(_leftPanel), "West");

    _cellPanel = new CellPanel(_connection);
    _commandPanel = new CommandPanel(_connection);

    _cardPanel = new Panel(_cards);
    _cardPanel.add(new BorderPanel(_cellPanel), "cell");
    _cardPanel.add(new BorderPanel(_commandPanel), "command");
    _cards.show(_cardPanel, "cell");

    add(_cardPanel, "Center");

    _updateButton.addActionListener(this);
    _detailButton.addActionListener(this);
    _commandButton.addActionListener(this);
    _list.addItemListener(this);
  }
示例#16
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);
  }
示例#17
0
  /**
   * IRC Constructor
   *
   * @param jo the JVN object representing the Chat
   */
  public Irc(JvnObject jo) {
    sentence = jo;
    frame = new JFrame();
    frame.setLayout(new GridLayout(1, 1));
    text = new TextArea(10, 60);
    text.setEditable(false);
    text.setForeground(Color.red);
    frame.add(text);
    data = new TextField(40);
    frame.add(data);
    Button read_button = new Button("read");
    read_button.addActionListener(new readListener(this));
    frame.add(read_button);
    Button write_button = new Button("write");
    write_button.addActionListener(new writeListener(this));
    frame.add(write_button);
    frame.setSize(545, 201);
    // frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    frame.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {
            System.out.println("Closed");
            try {
              JvnServerImpl.jvnGetServer().jvnTerminate();
            } catch (Exception exc) {
              System.out.println("An exception: " + exc);
            }

            e.getWindow().dispose();
          }
        });
    text.setBackground(Color.black);
    frame.setVisible(true);
  }
示例#18
0
  public DialogBox(Frame parent, String frametitle, String line1, String line2) {
    super(parent, frametitle, true);

    GridBagLayout gb = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    setLayout(gb);

    // line 1
    c.gridy = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    Label line1Label = new Label(line1, Label.CENTER);
    gb.setConstraints(line1Label, c);
    line1Label.setForeground(Color.blue);
    line1Label.setFont(new Font("arial", Font.BOLD | Font.ITALIC, 16));
    add(line1Label);

    // line 2
    c.gridy = 1;
    Label line2Label = new Label(line2, Label.CENTER);
    gb.setConstraints(line2Label, c);
    add(line2Label);

    // Button
    c.gridy = 2;
    c.fill = GridBagConstraints.NONE;
    Button okButton = new Button("OK");
    gb.setConstraints(okButton, c);
    okButton.addActionListener(this);
    add(okButton);

    setLocation(400, 200);
    pack();
    setVisible(true);
    toFront();
  }
  void login() {
    try {
      logoutBtn.setEnabled(true);
      contactList.setEditable(false);
      loginBtn.setEnabled(false);
      loginId.setEnabled(false);
      password.setEnabled(false);

      //
      plugin.login(
          getMyLoginId(), password.getText(), getContactList(), MessagingNetwork.STATUS_ONLINE);
      logoutBtn.setEnabled(true);
    } catch (Throwable tr) {
      printException(tr);
      boolean loggedIn = false;
      try {
        loggedIn = plugin.getClientStatus(getMyLoginId()) != MessagingNetwork.STATUS_OFFLINE;
      } catch (Throwable tr2) {
        printException(tr2);
      }
      if (!loggedIn) {
        enableLoginUI();
      }
    }
  }
示例#20
0
  void action() {
    Panel p = new Panel();

    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent we) {
            System.exit(0);
          }
        });

    but1 = new Button("버튼-1");
    but2 = new Button("버튼-2");

    // 버튼에 감지 기능 추가
    but1.addActionListener(this);
    but2.addActionListener(this);

    p.add(but1);
    p.add(but2);

    add(p, "North");

    tf = new TextField();
    add(tf, "South");
    setSize(150, 100);
    setVisible(true);
  }
示例#21
0
  // TextArea Text;
  public void init() {

    // Tell the applet not to use a layout manager.
    setSize(500, 500);
    setLayout(null);

    // initialze the button and give it a text.
    Rubric = new Button("Rubric Editor");
    GradeSheet = new Button("Grade Sheet Editor");
    TextArea text = new TextArea("Please Choose one of the following");

    // now we will specify the positions of the GUI components.
    // this is done by specifying the x and y coordinate and
    // the width and height.
    Rubric.setBounds(100, 275, 100, 30);
    GradeSheet.setBounds(230, 275, 150, 30);
    text.setBounds(100, 225, 300, 50);
    text.setEditable(false);
    (text).getScrollbarVisibility();
    // now that all is set we can add these components to the applet
    add(text);
    add(Rubric);
    add(GradeSheet);
    Rubric.addActionListener(this);
    GradeSheet.addActionListener(this);
  }
示例#22
0
  public MessageDialog(String message, Dialog owner) {
    super(owner);

    // WindowClosw時にリソースを開放してダイアログを閉じる
    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            dispose();
          }
        });

    setTitle("MessageDialog");

    setBounds(200, 200, 0, 0);
    setLayout(gbl);

    // (0, 0) 幅=50, 高さ=1
    Label label = new Label(message);
    gbl.setConstraints(label, MainFrame.setGBC(0, 0, 50, 1));
    add(label);

    // (0, 1) 幅=50, 高さ=1
    Button ok_btn = new Button("OK");
    gbl.setConstraints(ok_btn, MainFrame.setGBC(0, 1, 50, 1));
    add(ok_btn);

    ok_btn.addActionListener(this);

    pack();
    setModal(true);
    setVisible(true);
  }
示例#23
0
  public void actionPerformed(ActionEvent evt) {

    if (evt.getSource() == Rubric) {
      Rubric.setLabel("Loading...");
      try {
        Thread.sleep((1000));

      } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      removeAll();

      @SuppressWarnings("unused")
      RubricEditor_GUI RE = new RubricEditor_GUI();

    } else if (evt.getSource() == GradeSheet) {

      // Change the text on the button for fun
      GradeSheet.setLabel("Loading...");
      try {
        Thread.sleep((1000));
      } catch (InterruptedException e) {

        e.printStackTrace();
      }
      removeAll();

      @SuppressWarnings("unused")
      GradeSheetEditor_GUI GSE = new GradeSheetEditor_GUI();
    }
  }
示例#24
0
  public SafeFrame(String title) {
    super(title);
    setBackground(Color.lightGray);
    setLayout(new BorderLayout());

    // textClockを配置
    add(textClock, BorderLayout.NORTH);
    textClock.setEditable(false);

    // textScreenを配置
    add(textScreen, BorderLayout.CENTER);
    textScreen.setEditable(false);

    // パネルにボタンを格納
    Panel panel = new Panel();
    panel.add(buttonUse);
    panel.add(buttonAlarm);
    panel.add(buttonPhone);
    panel.add(buttonExit);

    // パネルを配置
    add(panel, BorderLayout.SOUTH);

    // 表示
    pack();
    show();

    // リスナーの設定
    buttonUse.addActionListener(this);
    buttonAlarm.addActionListener(this);
    buttonPhone.addActionListener(this);
    buttonExit.addActionListener(this);
  }
示例#25
0
  public Irc(Sentence_itf s) {

    setLayout(new FlowLayout());

    text = new TextArea(10, 60);
    text.setEditable(false);
    text.setForeground(Color.red);
    add(text);

    data = new TextField(60);
    add(data);

    Button write_button = new Button("write");
    write_button.addActionListener(new writeListener(this));
    add(write_button);
    Button read_button = new Button("read");
    read_button.addActionListener(new readListener(this));
    add(read_button);

    setSize(470, 300);
    text.setBackground(Color.black);
    show();

    sentence = s;
  }
 public Button designButton(Button b) {
   Border emptyBorder = BorderFactory.createEmptyBorder();
   b.setFocusable(false);
   b.setFont(new Font("Tahoma", Font.BOLD, 12));
   b.setForeground(Color.WHITE);
   b.setBackground(Color.DARK_GRAY);
   return b;
 }
示例#27
0
  public void init() {
    colorNo = 0;
    Button b = new Button("change");
    b.addActionListener(this);
    add(b);

    addMouseListener(this);
  }
示例#28
0
    // 이벤트 발생시 동작되는 메소드
    public void actionPerformed(ActionEvent e) {
      // 객체의 소스를 얻어와 버튼 객체화 시킴
      Button but = (Button) e.getSource();
      String lab = but.getLabel();

      if (lab.equals("왼쪽 버튼")) txtA.setText(txtA.getText() + " 왼쪽 버튼이 눌렸어요" + "\n");
      else txtA.setText(txtA.getText() + " 아래쪽 버튼이 눌렸어요" + "\n");
    }
示例#29
0
 public SimpleCapture() {
   super("Simple Capture Program");
   add(stopButton = new Button("Stop"), BorderLayout.WEST);
   stopButton.addActionListener(this);
   add(quitButton = new Button("Quit"), BorderLayout.EAST);
   quitButton.addActionListener(this);
   pack();
   setVisible(true);
 }
示例#30
0
  // Label lyes,lno;
  public void init() {
    byes = new Button("Yes");
    bno = new Button("No");
    add(byes);
    add(bno);

    bno.addActionListener(this);
    byes.addActionListener(this);
  }