Jump to content

  • Log In with Google      Sign In   
  • Create Account


How to create a splitter with buttons on it?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 MarekKnows.com   Members   -  Reputation: 448

Like
0Likes
Like

Posted 16 October 2013 - 07:03 AM

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, 16 October 2013 - 09:37 AM.

---
Free C++, OpenGL, and Game Development Video Tutorials @
www.MarekKnows.com
Play my free games: Ghost Toast, Zing, Jewel Thief


Sponsor:

#2 Glass_Knife   Moderators   -  Reputation: 3853

Like
0Likes
Like

Posted 16 October 2013 - 09:24 AM

I am not sure what you mean by a "Splitter".  Do you mean a JSplitPane, or something else?


I think, therefore I am. I think? - "George Carlin"
Indie Game Programming

#3 MarekKnows.com   Members   -  Reputation: 448

Like
0Likes
Like

Posted 16 October 2013 - 09:36 AM

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.


---
Free C++, OpenGL, and Game Development Video Tutorials @
www.MarekKnows.com
Play my free games: Ghost Toast, Zing, Jewel Thief





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS