Ejemplo n.º 1
0
  /**
   * This method is called from within the constructor to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    BackToMain = new javax.swing.JButton();
    jScrollPane1 = new javax.swing.JScrollPane();
    TypTextArea = new javax.swing.JTextArea();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    getContentPane().setLayout(null);

    BackToMain.setText("Back");
    BackToMain.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            BackToMainActionPerformed(evt);
          }
        });
    getContentPane().add(BackToMain);
    BackToMain.setBounds(0, 0, 72, 29);

    TypTextArea.setColumns(20);
    TypTextArea.setRows(5);
    jScrollPane1.setViewportView(TypTextArea);

    getContentPane().add(jScrollPane1);
    jScrollPane1.setBounds(70, 30, 500, 180);

    setSize(new java.awt.Dimension(627, 267));
    setLocationRelativeTo(null);
  } // </editor-fold>//GEN-END:initComponents
Ejemplo n.º 2
0
  public static void getTypes() {

    MongoClient mongoClient = new MongoClient("localhost", 27017);
    MongoDatabase db = mongoClient.getDatabase("database");
    MongoCollection<Document> elexirCollection = db.getCollection("test");

    FindIterable<Document> results =
        elexirCollection.find(new BasicDBObject("Objects", new BasicDBObject("$gt", ".0001")));
    // FindIterable<Document> iter = elexirCollection.find(new BasicDBObject("derivProb", 2));

    for (Document doc : results) {
      // do something with each result

      List<String> conv = (List<String>) doc.get("Types");

      String[] convArr = new String[conv.size()];
      convArr = conv.toArray(convArr);

      for (String s : convArr) TypTextArea.append(s + "\n");
    }
  }