Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #4407

Re: SWT and Robot

From "tomaszewski.p" <tomaszewski.p@THRWHITE.remove-dii-this>
Subject Re: SWT and Robot
Message-ID <d2f5d963-46f4-4af1-bb56-6b6b2cb7a27e@a1g2000hsb.googlegroups.com> (permalink)
Newsgroups comp.lang.java.gui
References <8fb97$49063485$544bcfc5$28128@news.hispeed.c
Date 2011-04-27 15:50 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
On Oct 27, 10:37 pm, Peter Müller <u...@example.net> wrote:
> I want to test my application using java.awt.Robot. The application is
> an SWT application. I tried to figure out the position of the controls
> but I failed.
> Here is my code for figuring out the position of the control:
>
>         for( Composite composite = this ;
>             composite != null ; composite = composite.getParent() ) {
>             parentX += composite.getBounds().x;
>             parentY += composite.getBounds().y;
>             shellX += composite.getShell().getBounds().x;
>             shellY += composite.getShell().getBounds().y;
>             displayX += composite.getDisplay().getBounds().x;
>             displayY += composite.getDisplay().getBounds().y;
>             locationX += composite.getLocation().x;
>             locationY += composite.getLocation().y;
>         }
>
>         buttonX = myButton.getBounds().x;
>         buttonY = myButton.getBounds().y;
>
>         // Results below are too small. Now part is negative
>         x = buttonX + displayX + shellX + parentX + locationX;
>         y = buttonY + displayY + shellY + parentY + locationY;
>
> The window uses some nested composites and therefore it is difficult to
> separate a little application containing the whole code. Whatsoever the
> computed results are quite wrong.

Maybe using SWTBot (http://swtbot.sourceforge.net/index.html) is
better solution?
Przemek

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | Next | Find similar


Thread

Re: SWT and Robot "tomaszewski.p" <tomaszewski.p@THRWHITE.remove-dii-this> - 2011-04-27 15:50 +0000

csiph-web