Forum Discussion

gxwheels152's avatar
gxwheels152
Occasional Contributor
3 years ago
Solved

Java Swing table - trouble setting a cell value

Our Application Under Test works extensively with Java Swing tables. We have been able to click on cells and also extract values from table cells for checkpoint purposes. But, we are having trouble...
  • gxwheels152's avatar
    3 years ago

    Here's the answer I discovered - when the setText() function is not opened up. Some feedback from the support desk & some additional trial and error helped connect the dots. 

    Hopefully this solution will help others as well

     

    Access Cells & Editing Tables in Java Swing

    1) access the cell in the manner appropriate for that cell:
       1a) DblClickCell
       1b) ClickCell

     

    This opens up the cell and any objects that are native to that cell.

     

    Objects we've seen within a cell:
       a) TextField
       b) Cell - used when a Date Picker Object is accessible for that field
       c) SuperComboBox with TextField & Button
       d) Filter Field - opened when clicking the SuperComboBox's Button

     

    You now mostly interact with objects within the activated cell. The Objects within the cell are now active because of step 1 above.
    There does seem to be 1 exception to this where you operate at the Table Level, using the Keys: "[Tab]" command. Step 3 has more details about that.

     


    2) Take the appropriate action for the objects in the cell, for example:
       a) SetText to change a Cell object
       b) Keys to update a TextField object
       c) ClickButton for a Button object
       d) Keys to type within a Filter Field object (filter field is part of a SuperComboBox)

    This maybe should have been obvious, but ... it's basically your typical OnScreen Actions once the cell and it's objects are active


    3) For Most fields -- simply hit the Tab key for the Table object in the following manner:
    EXCEPTION: see step 4 below
    NOTE: - hitting tab within our tables saves the action taken on the objects within the cell and moves you to the next cell or the next row
       a) Object - the Table
       b) Operation - Keys
       c) Value - "[Tab]"

    4) Tab out of a Sub-Objects when necesary -- If the Sub-Object is too deep or utilizing a common object as with the filter field (SuperComboBox) mentioned above, you must Tab out of the Sub-Object
       a) Object - the sub-object of the table's cell, e.g., the Filter Field
       b) Operation - Keys
       c) Value - "[Tab]"