Ejemplo n.º 1
0
  public void displayBuscaLetra() {
    if (encontradas.isEmpty()) {
      System.out.println("Nenhuma música encontrada!");
      letraNaView.setText("Nenhuma música encontrada!");
      if (!btnFecharLetra.isVisible()) btnFecharLetra.setVisible(true);
      if (!scrollPane.isVisible()) scrollPane.setVisible(true);
      return;
    }
    for (Iterator i = encontradas.iterator(); i.hasNext(); ) {
      Musica m = (Musica) i.next();
      System.out.println(m.getNome() + "\n\n" + m.getLetra());
      String letra = m.getNome() + " — " + m.getNomeArtista() + "\n\n" + m.getLetra();
      String letraHtml = "<html>" + letra.replace("\n", "<br>") + "</html>";

      letraNaView.setText(letraHtml);
      if (!btnFecharLetra.isVisible()) btnFecharLetra.setVisible(true);
      if (!scrollPane.isVisible()) scrollPane.setVisible(true);
    }
  }
Ejemplo n.º 2
0
 public void displayBuscaNome() {
   Collections.sort(encontradas);
   if (encontradas.isEmpty()) {
     System.out.println("Nenhuma música encontrada!");
     letraNaView.setText("Nenhuma música encontrada!");
     if (!btnFecharLetra.isVisible()) btnFecharLetra.setVisible(true);
     if (!scrollPane.isVisible()) scrollPane.setVisible(true);
     return;
   }
   letraNaView.setText("<html>");
   for (Iterator i = encontradas.iterator(); i.hasNext(); ) {
     Musica m = (Musica) i.next();
     System.out.println(m.getNome());
     letraNaView.setText(
         letraNaView.getText() + "<br>" + m.getNomeArtista() + " — " + m.getNome());
     if (!btnFecharLetra.isVisible()) btnFecharLetra.setVisible(true);
     if (!scrollPane.isVisible()) scrollPane.setVisible(true);
   }
   letraNaView.setText(letraNaView.getText() + "</html>");
 }
Ejemplo n.º 3
0
  public void save() {
    boolean isNoticed = false;
    if (!notice.isVisible()) {
      isNoticed = true;
      notice.setVisible(true);
      notice.setText("Saving...");
    }
    if (getOptions() != null) {
      DB database = null;
      try {
        database = factory.open(this.leveldbStore.getSelectedFile(), getOptions());
        DBIterator iterator = database.iterator();
        HashSet<byte[]> keys = new HashSet<>();

        for (iterator.seekToFirst(); iterator.hasNext(); iterator.next()) {
          keys.add(iterator.peekNext().getKey());
        }
        iterator.close();

        for (byte[] key : keys) {
          database.delete(key);
        }

        for (int i = 0; i < dataList.getModel().getSize(); ++i) {
          DBItem item = dataList.getModel().getElementAt(i);
          database.put(item.key, item.value);
        }
      } catch (Exception e) {
        JOptionPane.showMessageDialog(pane, "Unable to open database:\n" + e);
        e.printStackTrace();
      } finally {
        if (database != null) {
          try {
            database.close();
          } catch (IOException e) {
            JOptionPane.showMessageDialog(pane, "Unable to close database:\n" + e);
            e.printStackTrace();
          }
        }
        saveButton.setEnabled(false);
      }
    }
    if (isNoticed) {
      try {
        Thread.sleep(100);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
      notice.setVisible(false);
      notice.setText("");
    }
  }
  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.º 5
0
  /**
   * Set Status DB Info
   *
   * @param text text
   * @param dse data status event
   */
  public void setStatusDB(String text, DataStatusEvent dse) {
    //	log.config( "StatusBar.setStatusDB - " + text + " - " + created + "/" + createdBy);
    if (text == null || text.length() == 0) {
      statusDB.setText("");
      statusDB.setVisible(false);
    } else {
      StringBuffer sb = new StringBuffer(" ");
      sb.append(text).append(" ");
      statusDB.setText(sb.toString());
      if (!statusDB.isVisible()) statusDB.setVisible(true);
    }

    //  Save
    m_text = text;
    m_dse = dse;
  } //	setStatusDB
Ejemplo n.º 6
0
 /**
  * Set Info Line
  *
  * @param text text
  */
 public void setInfo(String text) {
   if (!infoLine.isVisible()) infoLine.setVisible(true);
   infoLine.setText(text);
 } //	setInfo
Ejemplo n.º 7
0
 public void setTitle(String title) {
   if (!titleLabel.isVisible()) titleLabel.setVisible(true);
   // Want to use HTML bold text
   titleLabel.setText("<html><b><u>" + title + "</u></b></html>");
 }
Ejemplo n.º 8
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);
  }