Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

JXMultiSplitPane is somewhat of a hybrid component using MultiSplitLayout which is somewhere between GridLayout and GridBagLayout. MultiSplitLayout divides its components into horizontal or vertical Splits which are composed of Leaf components(which accept components) and Dividers(which separate them).

Code Block
import groovy.swing.SwingXBuilder
def swing = new SwingXBuilder()
def frame = swing.frame(size:[300,300], title:'JXMultiSplitPane Demo') {
	multiSplitPane() {
		split() {
			leaf(name:"left")
			divider()
			leaf(name:"right")
		}
		button(text:"Left Button", constraints:"left")
		button(text:"Right Button", constraints:"right")
	}
}.show()

Vertical splits can be created by setting the Split property rowLayout to false.

The code above produces the below layout:

Here is the code for a slightly more complex layout:

Code Block
import groovy.swing.SwingXBuilder
def swing = new SwingXBuilder()
def frame = swing.frame(size:[300,300]) {
	multiSplitPane() {
		split() {
			leaf(name:"left")
			divider()
			split(rowLayout:false) {
				leaf(name:"top")
				divider()
				leaf(name:"bottom")
			}
		}
		button(text:"Left Button", constraints:"left")
		button(text:"Right Button", constraints:"right")
		button(text:"Top Button", constraints:"top")
		button(text:"Bottom Button", constraints:"bottom")
	}
}.show()

That code produces the following layout: