Forum Discussion

raj5c1's avatar
raj5c1
Occasional Contributor
8 years ago
Solved

getting display format of the data field in java swing table

I am trying to get the value from Date field of one of the columns in Jtable object. When i get the value i am using toString on it (OleValue is not working). But toString converting the date to defa...
  • HKosova's avatar
    8 years ago

    Hi raj5c1,

     

    Try this function:

    // Returns the displayed value in the specified JTable cell
    // Parameters:
    // table - a JTable object
    // row, column - integer indexes of the row and column
    function getRenderedValue(table, row, column) { var value = table.getValueAt(row, column); var renderer = table.getCellRenderer(row, column).getTableCellRendererComponent(table, value, false, false, row, column); if (aqObject.IsSupported(renderer, "getText")) { value = renderer.getText(); } return value; }

    It is based on the code found on GitHub:
    Extract table cell value from cell renderer rather than model