Skip to content

JSplitPane Divider

Continuously redraw the divider as it moves using JSplitPane

Section titled “Continuously redraw the divider as it moves using JSplitPane”
Continuously redraw the divider as it moves using JSplitPane

ContinuousLayout

Two JSplitPane dividers are used to synchronize movement and perform continuous redrawing.

Maintain the JSplitPane's stored state

KeepHiddenDivider

This setting ensures that the Divider remains retracted even when the JSplitPane's size is changed.

Change the position of the JSplitPane’s Divider after maximizing it

Section titled “Change the position of the JSplitPane’s Divider after maximizing it”
Change the position of the JSplitPane's Divider after maximizing it

DividerSplitRatio

This test demonstrates how to change the position of a JSPlitPane's Divider after maximizing a JFrame.

Place two JTables in a JSplitPane and synchronize their scrolling

Section titled “Place two JTables in a JSplitPane and synchronize their scrolling”
Place two JTables in a JSplitPane and synchronize their scrolling

SynchronizedScrollingTables

Place JTables on the left and right sides of the JSplitPane, and share the model so that scrolling and adding data are synchronized.

Change the size, color, etc. of the OneTouchButton that deploys and stores the JSplitPane Divider

Section titled “Change the size, color, etc. of the OneTouchButton that deploys and stores the JSplitPane Divider”
Change the size, color, etc. of the OneTouchButton that deploys and stores the JSplitPane Divider

OneTouchButton

This modifies the size, offset, and background color of the OneTouchButton used to expand and collapse the JSplitPane's Divider with a single click.

Set the background color of the Divider being dragged in JSplitPane

Section titled “Set the background color of the Divider being dragged in JSplitPane”
Set the background color of the Divider being dragged in JSplitPane

DividerDraggingColor

This modifies the color of the rectangle indicating the destination when a JSplitPane Divider is being dragged.

Divide JSplitPane into equal parts

DividerLocation

Set the JSplitPane divider to be in the center.

Deploy and retract the JSplitPane dividers

Section titled “Deploy and retract the JSplitPane dividers”
Deploy and retract the JSplitPane dividers

OneTouchExpandable

This setting allows you to quickly expand and collapse the JSplitPane dividers with a mouse click.

Prevent JSplitPane’s Divider from being moved with the mouse

Section titled “Prevent JSplitPane’s Divider from being moved with the mouse”
Prevent JSplitPane's Divider from being moved with the mouse

FixedDividerSplitPane

This sets the JSplitPane's Divider so that it cannot be moved by mouse or keyboard input.

Display images on a JSplitPane and compare the differences

Section titled “Display images on a JSplitPane and compare the differences”
Display images on a JSplitPane and compare the differences

ImageComparisonSplitPane

The original and processed images are displayed overlaid in JSplitPane, and the difference can be checked by changing the display range with Divider.

Change the JSplitPane’s Divider to a circular, semi-transparent knob and place it in the center

Section titled “Change the JSplitPane’s Divider to a circular, semi-transparent knob and place it in the center”
Change the JSplitPane's Divider to a circular, semi-transparent knob and place it in the center

TranslucentThumbDivider

We'll hide the original Divider of the JSplitPane and instead use a JLayer to create a semi-transparent circular handle and position it in the center.

Swap the positions of child components set in JSplitPane

Section titled “Swap the positions of child components set in JSplitPane”
Swap the positions of child components set in JSplitPane

SwappingSplitPane

This swaps the position of child components set in JSplitPane with the distribution ratio of extra space.

Select the JSplitPane’s Divider by clicking it with the mouse

Section titled “Select the JSplitPane’s Divider by clicking it with the mouse”
Select the JSplitPane's Divider by clicking it with the mouse

DividerFocus

This sets the JSplitPane's Divider to be selected when clicked with the mouse.

To make the horizontal JScrollBar of the JTable resizable, rearrange it into a JSPlitPane

Section titled “To make the horizontal JScrollBar of the JTable resizable, rearrange it into a JSPlitPane”
To make the horizontal JScrollBar of the JTable resizable, rearrange it into a JSPlitPane

ResizableHorizontalScrollBar

This code extracts a horizontal JScrollBar from a JScrollPane containing a JTable, and rearranges it into a JSPlitPane to make it resizable.

Add JPopupMenu and MouseListener to the Divider of JSplitPane and change their positions

Section titled “Add JPopupMenu and MouseListener to the Divider of JSplitPane and change their positions”
Add JPopupMenu and MouseListener to the Divider of JSplitPane and change their positions

DividerMouseEvent

Add a JPopupMenu and a MouseListener to the JSplitPane's Divider and set up Actions to change their position to the center, minimum, or maximum.

Change the resize cursor for JSplitPane and TableColumn

Section titled “Change the resize cursor for JSplitPane and TableColumn”
Change the resize cursor for JSplitPane and TableColumn

ResizeColumnCursor

This modifies the mouse cursor displayed when resizing components in JSplitPane's Divider or JTableHeader's TableColumn.

The tab components of JTabbedPane are placed in JSPlitPane so that they can be displayed in different sizes

Section titled “The tab components of JTabbedPane are placed in JSPlitPane so that they can be displayed in different sizes”
The tab components of JTabbedPane are placed in JSPlitPane so that they can be displayed in different sizes

TabComponentsOfDifferentSizes

Place the JTabbedPane inside the JSplitPane and adjust the position of the Divider and other elements so that each tab component can be displayed at a different size.

The JSplitPane’s deployment and storage buttons are positioned in the center of the Divider size

Section titled “The JSplitPane’s deployment and storage buttons are positioned in the center of the Divider size”
The JSplitPane's deployment and storage buttons are positioned in the center of the Divider size

CenterOneTouchButtons

Configure the JButton for quickly expanding/collapsed the JSplitPane to be centered within the Divider size.

Maintain the split ratio of JSplitPane

KeepSplitRatioSplitPane

This setting ensures that the JSplitPane maintains its division ratio even when its size is changed.

Section titled “Reset the JSplitPane’s Divider position to the recommended size”
Reset the JSplitPane's Divider position to the recommended size

SplitPaneResetToPreferredSizes

Resets the JSplitPane's Divider position to its initial state based on the recommended size of the child component.