*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 412
    
    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: 1280

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: 412
    
    2

thanks
 
Don't get me started about those stupid light bulbs.
 
subject: Test for button obscured
 
Similar Threads
size of submit button withn a table cell?
form submit in Firefox
style of a button
form being submitted twice
not able to call javascript function in firefox but able in IE in Iframe