Jump to content
  • Advertisement
Sign in to follow this  
mmakrzem

How to create a splitter with buttons on it?

This topic is 2101 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
Advertisement

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  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!