mabe02 / lanterna

Java library for creating text-based GUIs
GNU Lesser General Public License v3.0
2.24k stars 243 forks source link

Is it possible to temporarily hide a component? #456

Closed AObuchow closed 4 years ago

AObuchow commented 4 years ago

Is it possible for components to be hidden (not be rendered) somehow? I'd like to make a component appear only when a specific keystroke is inputted and later disappear.

I couldn't find any function to do this, perhaps there's a workaround?

keithkml commented 4 years ago

I think the workaround is simply to remove and re-add the component later. You could also try setting its preferred size to 0,0, though that might mess up layout, especially if the layout manager uses inter-component spacing.

AObuchow commented 4 years ago

Okay sounds good, thanks for the response :)

mabe02 commented 4 years ago

Yeah, there isn't any visible flag on the GUI components unfortunately. You'll need to remove and re-add them.