What’s the difference between Component.isShowing() and Component.isDisplayable()? I want to use them to decide wheter I should stop/start a Timer.
What’s the difference between Component.isShowing() and Component.isDisplayable() ? I want to use them to
Share
A component
isShowing()whenisShowing()is recursive and checks all parent components, too, butisDisplayable()andisVisible()verify only the state of the component, not that state of its parents.This means that your component is currently showing on the screen within a Frame, Panel, etc.
setVisible(true)–>isShowing()returns true (in most cases)setVisible(false)–>isShowing()returns false (in all cases)isDisplayable()whenThis means that your component is in a state where it can be shown on the screen but it doesn’t need to be currently shown on the screen to be in a
displayablestate. E.g., even ifsetVisible(false)was called on the component before (so the component is “invisible”) the component is stilldisplayableandisDisplayable()will return true.