Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Test for button obscured

 
Chris Hurst
Ranch Hand
Posts: 443
3
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 .
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> 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
Posts: 443
3
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic