Forum Discussion

champaramaiah's avatar
champaramaiah
Occasional Contributor
13 years ago

How to get Header value from Jtable

A table where column contains date and time and rows contains some values.

We need to change the interval and check whether the column as changed the time as specified by the interval. And we need to also check that the new values and time get update after every min.



In such case how to retrieve the header value from the table

6 Replies

  • champaramaiah's avatar
    champaramaiah
    Occasional Contributor
    Tried with getColumnModel.GetColumn(index).getheadervalue

    It displays alphabets {ex: "A" for index 0)



    Where as the column contains



    27- Dec

    1:00

  • Use following JTable properties to get the column header values. 












    wColumn

    Returns the caption of the column specified by its index.

    wColumnCount

    Returns the total number of grid columns.



    If you give some grid image and sample code its better to see the problem.
  • champaramaiah's avatar
    champaramaiah
    Occasional Contributor
    Hi,



    I am attaching an excel sheet with an example about how the application works



    In the excel sheet column A has some parameter names and column  [B --> H ] contain date and time.



    In row number 10, we have intervals specified for ex: 1 ,5, 10 mins



    So when you select the interval as 1 min or 5 min the columns [ B --> H] will also change according to the specified interval [Dynamically changes].

    For Ex: If you select interval as 1 min then the columns contain time with one minute difference.



    Column [B --> H] is identified as a  single object in testComplete.



    I need to retrieve a column header

    [ example: 27-Dec

                        1:01]



    as a single value. I need to obtain the header value for all the columns.





    Table has been created using Java.
  • champaramaiah's avatar
    champaramaiah
    Occasional Contributor
    I am unable to attach the file.

    Can you please provide any solution for this, else provide me your mail ID so that i can mail the excel sheet to you

  • Hi Champa,


     


    I've corrected the list of attachments. Now, you can attach the Excel file to your post.