JSplitPane overlaps JButtons in BorderLayout, but does not when layout is null
Posted
by
thaweatherman
on Stack Overflow
See other posts from Stack Overflow
or by thaweatherman
Published on 2012-12-06T05:02:24Z
Indexed on
2012/12/06
5:03 UTC
Read the original article
Hit count: 165
So I'm having another issue.....
I'm currently using a BorderLayout in my GUI so that when I resize my jframe, all of the internal components resize with it. I couldn't get any other layout to work with how I want the GUI to look while providing this resizing capability. At the top I have a JMenuBar, and below it I have a bunch of buttons. Below that I am supposed to have a JSplitPane, and it is there. However, the buttons seemed to be contained within the JSplitPane, which is not my intention. So when anything happens within the splitpane, the buttons disappear until I move my mouse over them again.
When I set my layout to null everything works great except I lose the resizing capability, which is not good.
Tried posting images but it wont let me since my rep isnt at 10 yet :(
Any suggestions? I've tried putting the buttons into a JPanel then adding the jpanel but the splitpane overlaps with that. Same with a JToolBar.
The order in which I add my items is:
1) the menu bar setJMenuBar(menuBar)
2) the buttons getContentPane().add(btnZoomIn) etc.
3) the split pane getContentPane().add(splitPane)
then the rest of the things you see after that
© Stack Overflow or respective owner