code: private void formatResultSet(ResultSet r) {
  
          if (r == null) {
              String[] g = new String[1];
  
              g[0] = "Result";
  
              gResult.setHead(g);
  
              g[0] = "(empty)";
  
              gResult.addRow(g);
  
              return;
          }
  
          try {
              ResultSetMetaData m         = r.getMetaData();
              int               col       = m.getColumnCount();
              Object[]          h         = new Object[col];
              boolean[]         isVarChar = new boolean[col];
  
              for (int i = 1; i <= col; i++) {
                  h[i - 1] = m.getColumnLabel(i);
                  isVarChar[i - 1] = (m.getColumnType(i)
                                      == java.sql.Types.VARCHAR);
              }
  
              gResult.setHead(h);
  
              while (r.next()) {
                  for (int i = 1; i <= col; i++) {
                      try {
                          h[i - 1] = r.getObject(i);
  
                          if (r.wasNull()) {
                              h[i - 1] = (isVarChar[i - 1] ? NULL_STR
                                                           : null);
                          }
                      } catch (SQLException e) {}
                  }
  
                  gResult.addRow(h);
              }
  
              r.close();
          } catch (SQLException e) {
  
              //  Added: (weconsultants@users)
              CommonSwing.errorMessage(e);
          }
      }
docs: We let Swing handle displaying nulls (which it generally does by
  printing nothing for them), except for the case of database
  VARCHARs, because this is the only class where there is any
  ambiguity about whether there is a null stored or not.