aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Test for button obscured Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Test for button obscured" Watch "Test for button obscured" New topic
Author

Test for button obscured

Chris Hurst
Ranch Hand

Joined: Oct 26, 2003
Posts: 420
    
    2

What the simplest, most elegant way to test a button is not obscured ie the user could click on it ?

ie the button isShowing and isVisible but its off the bottom of a dialog say, its for unit testing purposes .


"Eagles may soar but weasels don't get sucked into jet engines" SCJP 1.6, SCWCD 1.4, SCJD 1.5,SCBCD 5
Marco Ehrentreich
best scout
Bartender

Joined: Mar 07, 2007
Posts: 1282

Hi Chris,

I'm not sure if this is what you're looking for but wouldn't the method JComponent.isEnabled() simply tell you what you want to know? If it's true it means for a button that the user may click on it...

Marco
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> What the simplest, most elegant way to test a button is not obscured ie the user could click on it ?

don't know if this qualifies as elegant, but it works OK

run program, click button, should be false
scroll OK button into view, click check button, should now be true

Chris Hurst
Ranch Hand

Joined: Oct 26, 2003
Posts: 420
    
    2

thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Test for button obscured