Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using vertical splitter in Java Swing GUI?

I am developing a java desktop application. I have some doubts or problems in designing one thing which is as follows:

I want to break the the main frame

JFrame mainFrame = new JFrame("Demo");

into two parts (divided vertically) so that user can change their size by dragging the common boundary of both the parts to either left or right so that when the width of one part increases, the width of other part decreases so the size of the mainFrame remains same.

I am designing this GUI through Netbeans IDE so it is not necessary to suggest me the code. You can simply suggest me the "item" from the palette window that I can drag and drop to my mainFrame.

like image 811
Yatendra Avatar asked May 25 '26 11:05

Yatendra


1 Answers

You want a JSplitPane:

JSplitPane is used to divide two (and only two) Components. The two Components are graphically divided based on the look and feel implementation, and the two Components can then be interactively resized by the user.

like image 133
Joey Avatar answered May 27 '26 23:05

Joey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!