javaswingsplitpaneadjustment

Real time adjustments of split pane Java


I just created a simple split pane which has 2 textpanes on both the sides. It looks good, but when I try to move it left or right, it doesn't adjust the width in real time rather it shows a faint line while moving. When I release the mouse then the adjustments are made.

Is there any technique in java that I can adjust the widths in real time rather then the faint line moving and adjusting when mouse is released?

How I want 👇 Required

How It is 👇 How it is

See in the first one, the frame is adjusting the positions of the things in realtime(responsive).
But in my window the splitpane is actually creating a virtual one and when i release it then it is resizing the things.

How do I set it like the first one which adjust the things while moving the divider in realtime(responsive)?


Solution

  • Use the method setContinuousLayout(boolean newContinuousLayout) Use it like this 👇

    splitPane.setContinuousLayout(true);