Пример #1
0
 // Handle button clicks, specifically the next button
 public void actionPerformed(ActionEvent e) {
   if (btnext.getText().equals("Next")) {
     if (quizAnswerID < 9) {
       map.put(quizAnswerID, getSelection());
       quizAnswerID++;
       readQuestionAnswer(quizAnswerID);
     } else {
       map.put(quizAnswerID, getSelection());
       btnext.setText("Show results");
     }
   } else if (btnext.getText().equals("Show results")) {
     blankScreen();
   } else if (btnext.getText().equals("Try again")) {
     reset();
   }
 }
 public void actionPerformed(ActionEvent e) {
   if (e.getSource().equals(pausePlay)) {
     if (pausePlay.getText().equals("Play")) {
       pausePlay.setText("Pause");
       LifeSimulation.timer().start();
     } else {
       pausePlay.setText("Play");
       LifeSimulation.timer().stop();
     }
   }
 }
Пример #3
0
    public void mouseClicked(MouseEvent e) {
      if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 1) {
        JButton source = (JButton) e.getSource();

        String value = source.getText();
        int day = Integer.parseInt(value);
        calendar.set(Calendar.DAY_OF_MONTH, day);
        Date selectDate = this.getSelectDate();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
        MyDateChooseBtn.this.setText(simpleDateFormat.format(selectDate));
        Jtext.setText(simpleDateFormat.format(selectDate));

        int year = calendar.get(Calendar.YEAR);
        int month = calendar.get(Calendar.MONTH) + 1;
        //        System.out.println(year + "骞�" + month + "鏈�" + day + "鏃�");
        f.dispose();
      }
    }