private void updateMaskWarning() {
    if (myEnableFileNameFilterCb.isSelected()) {
      String mask = (String) myFileFilter.getEditor().getItem();
      if (mask == null || !isMaskValid(mask)) {
        showWarningAndDisableOK();
        return;
      }
    }

    if (myMaskWarningLabel.isVisible()) {
      clearWarningAndEnableOK();
    }
  }
Ejemplo n.º 2
0
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == start) {
      t.start();

      result.setVisible(false);
      scoreValue = 0;
      speed.setText("SPEED " + 40); // this is starting speeed
    }

    if (count % 10 == 0) {
      carNo = CarRace.randInt();

      if (carNo == 1 && flag1 == 0) {
        one.setVisible(true);
        one.setBounds(120, 100, 120, 70);
        pos1 = 100;
        flag1 = 1;
      }
      if (carNo == 2 && flag2 == 0) {
        two.setVisible(true);
        two.setBounds(240, 100, 120, 70);
        pos2 = 100;
        flag2 = 1;
      }

      if (carNo == 3 && flag3 == 0) {
        three.setVisible(true);
        three.setBounds(360, 100, 120, 70);
        pos3 = 100;
        flag3 = 1;
      }
    }

    count++;
    if (count >= 1000) count = 0;

    if (one.isVisible() == true) {
      one.setBounds(120, pos1, 120, 70);
      pos1 += 10;
      if (pos1 > 520) {
        flag1 = 0;
        one.setVisible(false);
      }
    }

    if (two.isVisible() == true) {
      two.setBounds(240, pos2, 120, 70);
      pos2 += 10;
      if (pos2 > 520) {
        flag2 = 0;
        two.setVisible(false);
      }
    }

    if (three.isVisible() == true) {
      three.setBounds(360, pos3, 120, 70);
      pos3 += 10;
      if (pos3 > 520) {
        flag3 = 0;
        three.setVisible(false);
      }
    }

    if (one.getY() + 70 == car.getY() && car.getX() == 120) {
      t.stop();
      result.setText(" SCORE " + scoreValue);
      result.setVisible(true);
    } else if (two.getY() + 70 == car.getY() && car.getX() == 240) {
      t.stop();
      result.setText(" SCORE " + scoreValue);
      result.setVisible(true);
    } else if (three.getY() + 70 == car.getY() && car.getX() == 360) {
      t.stop();
      result.setText(" SCORE " + scoreValue);
      result.setVisible(true);
    }

    scoreValue += 1;
    score.setText("score " + scoreValue);

    int m = 160 - x;
    if (m < 0) m = 0;
    speed.setText("SPEED " + m);
  }