Beispiel #1
0
  public void copyTable() {
    // create string
    String newline = System.getProperty("line.separator");
    StringBuffer output = new StringBuffer("[Table3D]" + newline);
    output.append(xAxis.getTableAsString() + newline);

    for (int y = 0; y < getSizeY(); y++) {
      output.append(yAxis.getCellAsString(y) + "\t");
      for (int x = 0; x < getSizeX(); x++) {
        output.append(data[x][y].getText());
        if (x < getSizeX() - 1) output.append("\t");
      }
      if (y < getSizeY() - 1) output.append(newline);
    }
    // copy to clipboard
    Toolkit.getDefaultToolkit()
        .getSystemClipboard()
        .setContents(new StringSelection(output + ""), null);
  }