Sign in to follow this  

How to create a splitter with buttons on it?

This topic is 1554 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'd like to create a GUI in Java which has a top section, a splitter below it and a main content section below the splitter. I'd like to make the splitter real fat (ie 100 pixels high), so that I can place some buttons on it. It could then act like a toolbar and a splitter at the same time in my application. 
 
How would I implement such a thing? Basically the splitter should still behave like a regular splitter when you move it up or down, but it has the added functionality of toolbar buttons on it.
Edited by MarekKnows.com

Share this post


Link to post
Share on other sites

Yes, JSplitPane.

 

I figured it out this morning.  I used splitPane.setDividerSize() to change the thickness of the splitter and JLayeredPane to place buttons on top of the splitter.  By watching the JSplitPane.LAST_DIVIDER_LOCATION_PROPERTY, I can update the position of the buttons on the splitter anytime a user moves the splitter.

Share this post


Link to post
Share on other sites
Sign in to follow this