简体   繁体   中英

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.

You want a JSplitPane :

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM