コード例 #1
0
  /**
   * Spawn a character on the map
   *
   * @param MiX Minimum X value
   * @param MiY Minimum Y value
   * @param MaX Maximum X value
   * @param MaY Maximum Y value
   */
  public void Spawn(int MiX, int MiY, int MaX, int MaY) {
    double Nx = 0, Ny = 0;

    // Random coordinate
    Nx = Math.random() * MaX + MiX;
    Ny = Math.random() * MaY + MiY;

    // Store block number
    int BNum = MAP.elementAt(0).getBlockNum(Nx + W / 2, Ny + H / 2);

    // if invalid block number
    if (BNum == -1) {
      Spawn(MiX, MiY, MaX, MaY);
    }

    // if invalid surface
    else if (!isValidSurface(MAP.elementAt(0).Fill[BNum])) {
      Spawn(MiX, MiY, MaX, MaY);
    }

    // if colliding with something
    else if (this.Collision(Nx + W / 2, Ny + H / 2)) {
      Spawn(MiX, MiY, MaX, MaY);
    } else {
      X = Nx;
      Y = Ny;
    }
  }
コード例 #2
0
ファイル: Clusters.java プロジェクト: arneboe/jplag
 public void writeMap(Cluster cluster, float yBar) {
   Set<Submission> subSet = new HashSet<Submission>(cluster.size());
   String documents = "";
   for (int i = 0; i < cluster.size(); i++) {
     Submission sub = submissions.elementAt(cluster.getSubmissionAt(i));
     documents += sub.name + " ";
     subSet.add(sub);
   }
   documents = documents.trim();
   String theme =
       ThemeGenerator.generateThemes(subSet, this.program.get_themewords(), false, this.program);
   mapString +=
       "<area shape=\"rect\" coords=\""
           + (cluster.x - 2)
           + ","
           + (yBar)
           + ","
           + (cluster.x + 2)
           + ","
           + (cluster.y + 2)
           + "\" onMouseover=\"set('"
           + cluster.size()
           + "','"
           + trimStringToLength(String.valueOf(cluster.getSimilarity()), 6)
           + "','"
           + trimStringToLength(documents, 50)
           + "','"
           + theme
           + "')\" ";
   //		if (cluster.size() == 1)
   //			mapString += "href=\"submission"+cluster.getSubmissionAt(0)+".html\">\n";
   //		else
   mapString += "nohref>\n";
 }
コード例 #3
0
 public void CompleteQuest(int Index) {
   Quest qstComp = QUEST_LIST.elementAt(Index);
   qstComp.STATUS = 3;
   qstComp.QUEST_GIVER.QUEST_LIST.elementAt(0).STATUS = 3;
   qstComp.QUEST_GIVER.QUEST_LIST.removeElementAt(0);
   STATS.IncreaseXP(qstComp.XP);
   GOLD += qstComp.GOLD;
 }
コード例 #4
0
  /**
   * Check character collision with all kinds of objects
   *
   * @param x X Coordinate
   * @param y Y Coordinate
   * @return if Character is about to collide with something
   */
  public boolean Collision(double x, double y) {
    boolean blnCol = false;
    // Wall Collision
    for (int i = 0; i < MAP.size(); i++) {
      blnCol = blnCol || WallCollision(x, y, MAP.elementAt(i));
    }
    // Game Object Collision
    for (int i = 0; i < OBJECTS.size(); i++) {
      blnCol = blnCol || ObjectCollision(x, y, OBJECTS.elementAt(i));
    }
    // Game Character collision
    for (int i = 0; i < CHARACTERS.size(); i++) {
      blnCol = blnCol || CharacterCollision(x, y, CHARACTERS.elementAt(i));
    }
    // Game Building Collision
    for (int i = 0; i < BUILD.size(); i++) {
      blnCol = blnCol || BuildingCollision(x, y, BUILD.elementAt(i));
    }

    return blnCol;
  }
コード例 #5
0
  /**
   * Used for debugging get list of spells available to character
   *
   * @return List
   */
  public String[] getSpellList() {
    // Make Array
    String[] arg = new String[SPELL_LIST.size()];

    // Assign names
    for (int i = 0; i < arg.length; i++) {
      arg[i] = SPELL_LIST.elementAt(i)[0].NAME;
      System.out.println(arg[i]);
    }

    // Return list
    return arg;
  }
コード例 #6
0
  /**
   * Draw character in game window
   *
   * @param g Graphics
   * @param Dx X Displacement
   * @param Dy Y Displacement
   * @param G Growth factor
   */
  public void Draw(Graphics g, int Dx, int Dy, double G) {
    // Draw blood
    if (ISDEAD) {
      g.drawImage(
          imgBLOOD,
          (int) (X + Dx - 25),
          (int) (Y + Dy - 15),
          (int) (W * GROWTHFACTOR + 35),
          (int) (H * GROWTHFACTOR + 35),
          null);
    }

    // Quest Givers
    if (CLASS != "Player") {
      for (int i = 0; i < QUEST_LIST.size(); i++) {
        if (QUEST_LIST.elementAt(i).STATUS == 0) {
          g.drawImage(imgQStart, (int) (X + Dx + 5), (int) (Y + Dy - 30), (int) W, 35, null);
        } else if (QUEST_LIST.elementAt(i).STATUS == 2) {
          g.drawImage(imgQEnd, (int) (X + Dx), (int) (Y + Dy - 30), (int) W + 5, 35, null);
        }
      }
    }

    // Draw character
    g.drawImage(
        imgCHARAC,
        (int) (X + Dx),
        (int) (Y + Dy),
        (int) (X + Dx + W * G),
        (int) (Y + Dy + H * G),
        (int) (W * FX),
        (int) (H * FY),
        (int) (W * FX + W),
        (int) (H * FY + H),
        null);

    GROWTHFACTOR = G;
  }
コード例 #7
0
 public void giveQuest(GameCharacter Reciever) {
   if (QUEST_LIST.size() > 0) {
     if (QUEST_LIST.elementAt(0).STATUS == 0) {
       Reciever.QUEST_LIST.add(QUEST_LIST.elementAt(0));
       QUEST_LIST.elementAt(0).play_UpdateSound();
       if (QUEST_LIST.elementAt(0).QTYPE == Quest_Type.DELIVERY) {
         for (int i = 0; i < QUEST_LIST.elementAt(0).TARGET_LIST.ITEM_NAME.size(); i++) {
           Reciever.INVENTORY.addItem(
               QUEST_LIST.elementAt(0).TARGET_LIST.ITEM_NAME.elementAt(i),
               QUEST_LIST.elementAt(0).TARGET_LIST.ITEM_PRICE.elementAt(i),
               QUEST_LIST.elementAt(0).TARGET_LIST.ITEM_QUANTITY.elementAt(i),
               QUEST_LIST.elementAt(0).TARGET_LIST.ITEM_IMAGE.elementAt(i),
               QUEST_LIST.elementAt(0).TARGET_LIST.ITEM_TAG.elementAt(i),
               QUEST_LIST.elementAt(0).TARGET_LIST.STATS.elementAt(i));
         }
       }
       QUEST_LIST.elementAt(0).STATUS = 1;
     }
   }
 }
コード例 #8
0
ファイル: TextLine.java プロジェクト: mytnyk/PRIAMUS
  /**
   * Parse the text then draw it without any rotation.
   *
   * @param g Graphics context
   * @param x pixel position of the text
   * @param y pixel position of the text
   */
  public void draw(Graphics g, int x, int y) {
    TextState ts;
    int xoffset = x;
    int yoffset = y;

    if (g == null || text == null) return;

    Graphics lg = g.create();

    parseText(g);

    if (justification == CENTER) {
      xoffset = x - width / 2;
    } else if (justification == RIGHT) {
      xoffset = x - width;
    }

    if (background != null) {
      lg.setColor(background);
      lg.fillRect(xoffset, yoffset - ascent, width, height);
      lg.setColor(g.getColor());
    }

    if (font != null) lg.setFont(font);
    if (color != null) lg.setColor(color);

    for (int i = 0; i < list.size(); i++) {
      ts = ((TextState) (list.elementAt(i)));
      if (ts.f != null) lg.setFont(ts.f);
      if (ts.s != null) lg.drawString(ts.toString(), ts.x + xoffset, ts.y + yoffset);
    }

    lg.dispose();

    lg = null;
  }
コード例 #9
0
  /** Method declaration */
  void showResultInText() {

    String col[] = gResult.getHead();
    int width = col.length;
    int size[] = new int[width];
    Vector data = gResult.getData();
    String row[];
    int height = data.size();

    for (int i = 0; i < width; i++) {
      size[i] = col[i].length();
    }

    for (int i = 0; i < height; i++) {
      row = (String[]) data.elementAt(i);

      for (int j = 0; j < width; j++) {
        int l = row[j].length();

        if (l > size[j]) {
          size[j] = l;
        }
      }
    }

    StringBuffer b = new StringBuffer();

    for (int i = 0; i < width; i++) {
      b.append(col[i]);

      for (int l = col[i].length(); l <= size[i]; l++) {
        b.append(' ');
      }
    }

    b.append(NL);

    for (int i = 0; i < width; i++) {
      for (int l = 0; l < size[i]; l++) {
        b.append('-');
      }

      b.append(' ');
    }

    b.append(NL);

    for (int i = 0; i < height; i++) {
      row = (String[]) data.elementAt(i);

      for (int j = 0; j < width; j++) {
        b.append(row[j]);

        for (int l = row[j].length(); l <= size[j]; l++) {
          b.append(' ');
        }
      }

      b.append(NL);
    }

    b.append(NL + height + " row(s) in " + lTime + " ms");
    txtResult.setText(b.toString());
  }
コード例 #10
0
  /** Method declaration */
  private void refreshTree() {

    tTree.removeAll();

    try {
      int color_table = Color.yellow.getRGB();
      int color_column = Color.orange.getRGB();
      int color_index = Color.red.getRGB();

      tTree.addRow("", dMeta.getURL(), "-", 0);

      String usertables[] = {"TABLE"};
      ResultSet result = dMeta.getTables(null, null, null, usertables);
      Vector tables = new Vector();

      // sqlbob@users Added remarks.
      Vector remarks = new Vector();

      while (result.next()) {
        tables.addElement(result.getString(3));
        remarks.addElement(result.getString(5));
      }

      result.close();

      for (int i = 0; i < tables.size(); i++) {
        String name = (String) tables.elementAt(i);
        String key = "tab-" + name + "-";

        tTree.addRow(key, name, "+", color_table);

        // sqlbob@users Added remarks.
        String remark = (String) remarks.elementAt(i);

        if ((remark != null) && !remark.trim().equals("")) {
          tTree.addRow(key + "r", " " + remark);
        }

        ResultSet col = dMeta.getColumns(null, null, name, null);

        while (col.next()) {
          String c = col.getString(4);
          String k1 = key + "col-" + c + "-";

          tTree.addRow(k1, c, "+", color_column);

          String type = col.getString(6);

          tTree.addRow(k1 + "t", "Type: " + type);

          boolean nullable = col.getInt(11) != DatabaseMetaData.columnNoNulls;

          tTree.addRow(k1 + "n", "Nullable: " + nullable);
        }

        col.close();
        tTree.addRow(key + "ind", "Indices", "+", 0);

        ResultSet ind = dMeta.getIndexInfo(null, null, name, false, false);
        String oldiname = null;

        while (ind.next()) {
          boolean nonunique = ind.getBoolean(4);
          String iname = ind.getString(6);
          String k2 = key + "ind-" + iname + "-";

          if ((oldiname == null || !oldiname.equals(iname))) {
            tTree.addRow(k2, iname, "+", color_index);
            tTree.addRow(k2 + "u", "Unique: " + !nonunique);

            oldiname = iname;
          }

          String c = ind.getString(9);

          tTree.addRow(k2 + "c-" + c + "-", c);
        }

        ind.close();
      }

      tTree.addRow("p", "Properties", "+", 0);
      tTree.addRow("pu", "User: "******"pr", "ReadOnly: " + cConn.isReadOnly());
      tTree.addRow("pa", "AutoCommit: " + cConn.getAutoCommit());
      tTree.addRow("pd", "Driver: " + dMeta.getDriverName());
      tTree.addRow("pp", "Product: " + dMeta.getDatabaseProductName());
      tTree.addRow("pv", "Version: " + dMeta.getDatabaseProductVersion());
    } catch (SQLException e) {
      tTree.addRow("", "Error getting metadata:", "-", 0);
      tTree.addRow("-", e.getMessage());
      tTree.addRow("-", e.getSQLState());
    }

    tTree.update();
  }
コード例 #11
0
  void refresh() {

    JPanel4.showCard("router"); // No Internationalisation
    if (routerobject != null) {
      ((com.adventnet.nms.examples.routermap.RouterDetails) JPanel4.getCard("router"))
          .setValues((Properties) routerobject.elementAt(0)); // No Internationalisation
      Properties prop = (Properties) routerobject.elementAt(0);
      RouterBtn.setBackground(
          SeverityInfo.getInstance()
              .getColor(Integer.parseInt(prop.getProperty("status")))); // No Internationalisation
      RouterBtn.setToolTipText(prop.getProperty("ipAddress")); // No Internationalisation
      JLabel1.setText(
          NmsClientUtil.GetString("Router details  :  ")
              + prop.getProperty("name")); // No Internationalisation
    }
    if (routerobject.size() >= 2) {
      one.setVisible(true);
      Properties prop = (Properties) routerobject.elementAt(1);
      one.setValues(
          SeverityInfo.getInstance().getColor(Integer.parseInt(prop.getProperty("status"))),
          prop.getProperty("ipAddress")); // No Internationalisation
      one.setToolTipText(prop.getProperty("ipAddress")); // No Internationalisation
    }
    if (routerobject.size() >= 3) {
      two.setVisible(true);
      Properties prop = (Properties) routerobject.elementAt(2);
      two.setValues(
          SeverityInfo.getInstance().getColor(Integer.parseInt(prop.getProperty("status"))),
          prop.getProperty("ipAddress")); // No Internationalisation
      two.setToolTipText(prop.getProperty("ipAddress")); // No Internationalisation
    }
    if (routerobject.size() >= 4) {
      three.setVisible(true);
      Properties prop = (Properties) routerobject.elementAt(3);
      three.setValues(
          SeverityInfo.getInstance().getColor(Integer.parseInt(prop.getProperty("status"))),
          prop.getProperty("ipAddress")); // No Internationalisation
      three.setToolTipText(prop.getProperty("ipAddress")); // No Internationalisation
    }
    if (routerobject.size() >= 5) {
      four.setVisible(true);
      Properties prop = (Properties) routerobject.elementAt(4);
      four.setValues(
          SeverityInfo.getInstance().getColor(Integer.parseInt(prop.getProperty("status"))),
          prop.getProperty("ipAddress")); // No Internationalisation
      four.setToolTipText(prop.getProperty("ipAddress")); // No Internationalisation
    }
    if (routerobject.size() >= 6) {
      five.setVisible(true);
      Properties prop = (Properties) routerobject.elementAt(5);
      five.setValues(
          SeverityInfo.getInstance().getColor(Integer.parseInt(prop.getProperty("status"))),
          prop.getProperty("ipAddress")); // No Internationalisation
      five.setToolTipText(prop.getProperty("ipAddress")); // No Internationalisation
    }
    if (routerobject.size() >= 7) {
      six.setVisible(true);
      Properties prop = (Properties) routerobject.elementAt(6);
      six.setValues(
          SeverityInfo.getInstance().getColor(Integer.parseInt(prop.getProperty("status"))),
          prop.getProperty("ipAddress")); // No Internationalisation
      six.setToolTipText(prop.getProperty("ipAddress")); // No Internationalisation
    }
    if (routerobject.size() >= 8) {
      seven.setVisible(true);
      Properties prop = (Properties) routerobject.elementAt(7);
      seven.setValues(
          SeverityInfo.getInstance().getColor(Integer.parseInt(prop.getProperty("status"))),
          prop.getProperty("ipAddress")); // No Internationalisation
      seven.setToolTipText(prop.getProperty("ipAddress")); // No Internationalisation
    }
    if (routerobject.size() >= 9) {
      eight.setVisible(true);
      Properties prop = (Properties) routerobject.elementAt(8);
      eight.setValues(
          SeverityInfo.getInstance().getColor(Integer.parseInt(prop.getProperty("status"))),
          prop.getProperty("ipAddress")); // No Internationalisation
      eight.setToolTipText(prop.getProperty("ipAddress")); // No Internationalisation
    }
    if (routerobject.size() >= 10) {
      nine.setVisible(true);
      Properties prop = (Properties) routerobject.elementAt(9);
      nine.setValues(
          SeverityInfo.getInstance().getColor(Integer.parseInt(prop.getProperty("status"))),
          prop.getProperty("ipAddress")); // No Internationalisation
      nine.setToolTipText(prop.getProperty("ipAddress")); // No Internationalisation
    }
    if (routerobject.size() >= 11) {
      ten.setVisible(true);
      Properties prop = (Properties) routerobject.elementAt(10);
      ten.setValues(
          SeverityInfo.getInstance().getColor(Integer.parseInt(prop.getProperty("status"))),
          prop.getProperty("ipAddress")); // No Internationalisation
      ten.setToolTipText(prop.getProperty("ipAddress")); // No Internationalisation
    }
  }
コード例 #12
0
ファイル: TextLine.java プロジェクト: mytnyk/PRIAMUS
  /**
   * parse the text. When the text is parsed the width, height, leading are all calculated. The text
   * will only be truly parsed if the graphics context has changed or the text has changed or the
   * font has changed. Otherwise nothing is done when this method is called.
   *
   * @param g Graphics context.
   */
  public void parseText(Graphics g) {
    FontMetrics fm;
    TextState current = new TextState();
    char ch;
    Stack state = new Stack();
    int w = 0;

    if (lg != g) parse = true;
    lg = g;

    if (!parse) return;

    parse = false;
    width = 0;
    leading = 0;
    ascent = 0;
    descent = 0;
    height = 0;
    maxAscent = 0;
    maxDescent = 0;

    if (text == null || g == null) return;

    list.removeAllElements();

    if (font == null) current.f = g.getFont();
    else current.f = font;

    state.push(current);
    list.addElement(current);

    fm = g.getFontMetrics(current.f);

    for (int i = 0; i < text.length(); i++) {
      ch = text.charAt(i);

      switch (ch) {
        case '$':
          i++;
          if (i < text.length()) current.s.append(text.charAt(i));
          break;
          /*
           **                    Push the current state onto the state stack
           **                    and start a new storage string
           */
        case '{':
          w = current.getWidth(g);
          if (!current.isEmpty()) {
            current = current.copyState();
            list.addElement(current);
          }

          state.push(current);
          current.x += w;
          break;
          /*
           **                    Pop the state off the state stack and set the current
           **                    state to the top of the state stack
           */
        case '}':
          w = current.x + current.getWidth(g);
          state.pop();
          current = ((TextState) state.peek()).copyState();
          list.addElement(current);
          current.x = w;
          break;
        case '^':
          w = current.getWidth(g);
          if (!current.isEmpty()) {
            current = current.copyState();
            list.addElement(current);
          }
          current.f = getScriptFont(current.f);
          current.x += w;
          current.y -= (int) ((double) (current.getAscent(g)) * sup_offset + 0.5);
          break;
        case '_':
          w = current.getWidth(g);
          if (!current.isEmpty()) {
            current = current.copyState();
            list.addElement(current);
          }
          current.f = getScriptFont(current.f);
          current.x += w;
          current.y += (int) ((double) (current.getDescent(g)) * sub_offset + 0.5);
          break;

        default:
          current.s.append(ch);
          break;
      }
    }

    for (int i = 0; i < list.size(); i++) {
      current = ((TextState) (list.elementAt(i)));

      if (!current.isEmpty()) {
        width += current.getWidth(g);
        ascent = Math.max(ascent, Math.abs(current.y) + current.getAscent(g));
        descent = Math.max(descent, Math.abs(current.y) + current.getDescent(g));
        leading = Math.max(leading, current.getLeading(g));

        maxDescent = Math.max(maxDescent, Math.abs(current.y) + current.getMaxDescent(g));
        maxAscent = Math.max(maxAscent, Math.abs(current.y) + current.getMaxAscent(g));
      }
    }

    height = ascent + descent + leading;

    return;
  }
コード例 #13
0
ファイル: Clusters.java プロジェクト: arneboe/jplag
  /** This method returns the distribution HTML code as a string */
  private String outputClustering(HTMLFile f, Collection<Cluster> allClusters, int maxSize) {
    int[] distribution = new int[maxSize + 1];
    int max = 0;
    for (int i = 0; i <= maxSize; i++) distribution[i] = 0;

    // Now output the clustering:
    f.println("<TABLE CELLPADDING=2 CELLSPACING=2>");

    f.println(
        "<TR><TH ALIGN=center BGCOLOR=#8080ff>"
            + msg.getString("Clusters.Cluster_number")
            + "<TH ALIGN=center BGCOLOR=#8080ff>"
            + msg.getString("Clusters.Size")
            + "<TH ALIGN=center BGCOLOR=#8080ff>"
            + msg.getString("Clusters.Threshold")
            + "<TH ALIGN=center BGCOLOR=#8080ff>"
            + msg.getString("Clusters.Cluster_members")
            + "<TH ALIGN=center BGCOLOR=#8080ff>"
            + msg.getString("Clusters.Most_frequent_words")
            + "</TR>");
    Iterator<Cluster> clusterI = allClusters.iterator();
    for (int i = 1; clusterI.hasNext(); i++) {
      Cluster cluster = clusterI.next();
      if (max < ++distribution[cluster.size()]) max = distribution[cluster.size()];

      // no singleton clusters
      if (cluster.size() == 1) continue;

      f.print(
          "<TR><TD ALIGN=center BGCOLOR=#8080ff>"
              + i
              + "<TD ALIGN=center BGCOLOR=#c0c0ff>"
              + cluster.size()
              + "<TD ALIGN=center BGCOLOR=#c0c0ff>"
              + cluster.getSimilarity()
              + "<TD ALIGN=left BGCOLOR=#c0c0ff>");

      // sort names
      TreeSet<Submission> sortedSubmissions = new TreeSet<Submission>();
      for (int x = 0; x < cluster.size(); x++) {
        sortedSubmissions.add(submissions.elementAt(cluster.getSubmissionAt(x)));
      }

      for (Iterator<Submission> iter = sortedSubmissions.iterator(); iter.hasNext(); ) {
        Submission sub = iter.next();
        int index = submissions.indexOf(sub);
        f.print("<A HREF=\"submission" + index + ".html\">" + sub.name + "</A>");
        if (iter.hasNext()) f.print(", ");
        neededSubmissions.add(sub); // write files for these.
      }

      if (this.program.get_language() instanceof jplag.text.Language) {
        f.println(
            "<TD ALIGN=left BGCOLOR=#c0c0ff>"
                + ThemeGenerator.generateThemes(
                    sortedSubmissions, this.program.get_themewords(), true, this.program));
      } else {
        f.println("<TD ALIGN=left BGCOLOR=#c0c0ff>-");
      }

      f.println("</TR>");
    }
    f.println("</TABLE>\n<P>\n");

    f.println("<H5>" + msg.getString("Clusters.Distribution_of_cluster_size") + ":</H5>");

    String text;
    text = "<TABLE CELLPADDING=1 CELLSPACING=1>\n";
    text +=
        "<TR><TH ALIGN=center BGCOLOR=#8080ff>"
            + msg.getString("Clusters.Cluster_size")
            + "<TH ALIGN=center BGCOLOR=#8080ff>"
            + msg.getString("Clusters.Number_of_clusters")
            + "<TH ALIGN=center BGCOLOR=#8080ff>.</TR>\n";
    for (int i = 0; i <= maxSize; i++) {
      if (distribution[i] == 0) continue;
      text +=
          "<TR><TD ALIGN=center BGCOLOR=#c0c0ff>"
              + i
              + "<TD ALIGN=right BGCOLOR=#c0c0ff>"
              + distribution[i]
              + "<TD BGCOLOR=#c0c0ff>\n";
      for (int j = (distribution[i] * barLength / max); j > 0; j--) text += ("#");
      if (distribution[i] * barLength / max == 0) {
        if (distribution[i] == 0) text += (".");
        else text += ("#");
      }
      text += ("</TR>\n");
    }
    text += ("</TABLE>\n");

    f.print(text);
    return text;
  }
コード例 #14
0
  /* Clear all existing nodes from the tree model and rebuild from scratch.
   */
  protected void refreshTree() {

    DefaultMutableTreeNode propertiesNode;
    DefaultMutableTreeNode leaf;

    // First clear the existing tree by simply enumerating
    // over the root node's children and removing them one by one.
    while (treeModel.getChildCount(rootNode) > 0) {
      DefaultMutableTreeNode child = (DefaultMutableTreeNode) treeModel.getChild(rootNode, 0);

      treeModel.removeNodeFromParent(child);
      child.removeAllChildren();
      child.removeFromParent();
    }

    treeModel.nodeStructureChanged(rootNode);
    treeModel.reload();
    tScrollPane.repaint();

    // Now rebuild the tree below its root
    try {

      // Start by naming the root node from its URL:
      rootNode.setUserObject(dMeta.getURL());

      // get metadata about user tables by building a vector of table names
      String usertables[] = {"TABLE", "GLOBAL TEMPORARY", "VIEW"};
      ResultSet result = dMeta.getTables(null, null, null, usertables);
      Vector tables = new Vector();

      // sqlbob@users Added remarks.
      Vector remarks = new Vector();

      while (result.next()) {
        tables.addElement(result.getString(3));
        remarks.addElement(result.getString(5));
      }

      result.close();

      // For each table, build a tree node with interesting info
      for (int i = 0; i < tables.size(); i++) {
        String name = (String) tables.elementAt(i);
        DefaultMutableTreeNode tableNode = makeNode(name, rootNode);
        ResultSet col = dMeta.getColumns(null, null, name, null);

        // sqlbob@users Added remarks.
        String remark = (String) remarks.elementAt(i);

        if ((remark != null) && !remark.trim().equals("")) {
          makeNode(remark, tableNode);
        }

        // With a child for each column containing pertinent attributes
        while (col.next()) {
          String c = col.getString(4);
          DefaultMutableTreeNode columnNode = makeNode(c, tableNode);
          String type = col.getString(6);

          makeNode("Type: " + type, columnNode);

          boolean nullable = col.getInt(11) != DatabaseMetaData.columnNoNulls;

          makeNode("Nullable: " + nullable, columnNode);
        }

        col.close();

        DefaultMutableTreeNode indexesNode = makeNode("Indices", tableNode);
        ResultSet ind = dMeta.getIndexInfo(null, null, name, false, false);
        String oldiname = null;

        // A child node to contain each index - and its attributes
        while (ind.next()) {
          DefaultMutableTreeNode indexNode = null;
          boolean nonunique = ind.getBoolean(4);
          String iname = ind.getString(6);

          if ((oldiname == null || !oldiname.equals(iname))) {
            indexNode = makeNode(iname, indexesNode);

            makeNode("Unique: " + !nonunique, indexNode);

            oldiname = iname;
          }

          // And the ordered column list for index components
          makeNode(ind.getString(9), indexNode);
        }

        ind.close();
      }

      // Finally - a little additional metadata on this connection
      propertiesNode = makeNode("Properties", rootNode);

      makeNode("User: "******"ReadOnly: " + cConn.isReadOnly(), propertiesNode);
      makeNode("AutoCommit: " + cConn.getAutoCommit(), propertiesNode);
      makeNode("Driver: " + dMeta.getDriverName(), propertiesNode);
      makeNode("Product: " + dMeta.getDatabaseProductName(), propertiesNode);
      makeNode("Version: " + dMeta.getDatabaseProductVersion(), propertiesNode);
    } catch (SQLException se) {
      propertiesNode = makeNode("Error getting metadata:", rootNode);

      makeNode(se.getMessage(), propertiesNode);
      makeNode(se.getSQLState(), propertiesNode);
    }

    treeModel.nodeStructureChanged(rootNode);
    treeModel.reload();
    tScrollPane.repaint();
  }