Forum Discussion

DineshVummidid's avatar
DineshVummidid
Occasional Contributor
8 years ago

Unable to perform actions on java swing trees

Hi Team,

 

Am doing feasability study on java based desktop application where used swing objects.

 

Getting trouble perform actions java swing tree.

 

Please find the code

 

Set JTreeObj=Sys.Process("java").SwingObject("BDMainFrame", "BD FACSDiva Software - Administrator (3-laser, 8-color (4-2H-2V) (BD default))", 0).SwingObject("JRootPane", "", 0).SwingObject("null.layeredPane").SwingObject("null.contentPane").SwingObject("JDesktopPane", "", 0).SwingObject("Browser").SwingObject("JRootPane", "", 0).SwingObject("null.layeredPane").SwingObject("null.contentPane").SwingObject("BrowserPane", "", 0).SwingObject("JScrollPane", "", 0).SwingObject("JViewport", "", 0).SwingObject("BrowserTreek", "", 0)ort", "", 0)

 

From the above object, couldnt able perform expand, collapse tree and selection option from tree.

 

Request you to kindly help on this issue.

 

Thanks,

Dinesh.

5 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    OK... a few things:

    First of all, when you install TestComplete, there is a sample project installed that demonstrates working with Java Swing Trees including a sample application to show how it works. I would suggest checking out that sample to figure out how to work with Java Swing Trees. Some basic starter information is https://support.smartbear.com/testcomplete/docs/reference/test-objects/controls/desktop/java/tree/index.html

     

    Secondly, you are referencing your object using the Sys tree... and while you can do so, your screenshot shows that the object you are attempting to work with is mapped in the NameMapping portion of your project. This is a MUCH more stable and MUCH easier way to work with object identification.  You can even use the Aliasing to "shorten" your object paths to something more manageable. There are a lot of "panes" and browsers and such in your object path that appear to simply be containers for the tree it self... You might be able to filter some of that down.

    Finally, you gave us the code that you are using for identifying the object, however, you're not showing us any of the code that you are using to do the expand or select. If you are having problems, it would be helpful to see the code, get text of any error messages you are getting, even get a screenshot showing the methods of the object you are trying to reference.

    • DineshVummidid's avatar
      DineshVummidid
      Occasional Contributor

      Hi Robert,

       

      Please find the code action expand and clicking performed. 

       

      Script recored with coordinates when i preform action expand and click option in java tree.

       

      Set desktopPane = Aliases.java.BDMainFrame.RootPane.null_layeredPane.null_contentPane.DesktopPane
      Set panel = desktopPane.Browser.RootPane.null_layeredPane.null_contentPane
      Set browserTreek = panel.BrowserPane.ScrollPane.Viewport.BrowserTreek
      Call browserTreek.Click(28, 28)
      Call browserTreek.Click(49, 67)
      Call browserTreek.Click(107, 63)
      Call browserTreek.Click(105, 78)

       

      Sys.Process("java").SwingObject("BDMainFrame", "BD FACSDiva Software - Administrator (3-laser, 8-color (4-2H-2V) (BD default))", 0).SwingObject("JRootPane", "", 0).SwingObject("null.layeredPane").SwingObject("null.contentPane").SwingObject("JDesktopPane", "", 0).SwingObject("Browser").SwingObject("JRootPane", "", 0).SwingObject("null.layeredPane").SwingObject("null.contentPane").SwingObject("BrowserPane", "", 0).SwingObject("JScrollPane", "", 0).SwingObject("JViewport", "", 0).SwingObject("BrowserTreek", "", 0).AWTObject("CellRendererPane", "", 0)

       

      Please do the neefull.

       

      Thanks,

      Dinesh.