Swing JDesktopPane with Scrollbars
Join the DZone community and get the full member experience.Join For Free
for a long time there has been a known issue with swing’s jdesktoppane. if a jinternalframe gets out of the viewport, no scrollbars are added and you loose the ability to “reach” the jinternalframe.
recently i had to fix this for a project. i searched the web for a simple straight solution to this issue but couldn’t find one so i decided to put my hands on the problem and try to fix it.. i’ve come up with a solution and decided to share it on github.
all you have to do is simply pass a jdesktoppane to this component and add it to a app where you would add the jdesktoppane.
at the base of this problem is the fact that the jdesktoppane doesn’t update its preferred size when the jinternalframes get out of the viewport. this component will keep track of the jinternalframes position and add scrollbars when it’s appropriate.
you can grab the code at: https://github.com/dukke/swing-desktopscrollpane
Published at DZone with permission of Pedro Duque Vieira, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Effortlessly Streamlining Test-Driven Development and CI Testing for Kafka Developers
Knowing and Valuing Apache Kafka’s ISR (In-Sync Replicas)
SRE vs. DevOps
5 Key Concepts for MQTT Broker in Sparkplug Specification