Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSplitPane divider getting stuck #483

Open
mgarin opened this issue Mar 21, 2018 · 0 comments
Open

JSplitPane divider getting stuck #483

mgarin opened this issue Mar 21, 2018 · 0 comments

Comments

@mgarin
Copy link
Owner

mgarin commented Mar 21, 2018

I found out in one of my projects that a BasicSplitPaneUI port in a form of WSplitPaneUI class that I've pushed a few commits ago actually has some weird issue with a few specific JDK versions. JSplitPane that uses WebLaF UI class gets its divider stuck whenever JSplitPane is set to non-continuous layout and divider drag operation starts. You are able to unstuck divider by dragging it once again.

All JDK 8 updates up to but not including u66 seem to have this issue. JDK 6, JDK 7, JDK 8 u66 and later updates and JDK 9 doesn't seem to have that issue.

Here is a small example that clearly shows the issue:

public class SplitPaneDividerIssue
{
    public static void main ( final String[] args )
    {
        SwingUtilities.invokeLater ( new Runnable ()
        {
            @Override
            public void run ()
            {
                WebLookAndFeel.install ();

                final JComponent left = new JLabel ( "Test", WebLabel.CENTER );
                final JComponent right = new JLabel ( "Test", WebLabel.CENTER );

                final JSplitPane splitPane = new JSplitPane ( JSplitPane.HORIZONTAL_SPLIT, left, right );
                splitPane.setPreferredSize ( new Dimension ( 300, 200 ) );
                splitPane.setResizeWeight ( 0.5 );
                splitPane.setContinuousLayout ( false );
                splitPane.setOneTouchExpandable ( true );

                final JFrame frame = new JFrame ();
                frame.add ( splitPane );
                frame.pack ();
                frame.setLocationRelativeTo ( null );
                frame.setDefaultCloseOperation ( WindowConstants.EXIT_ON_CLOSE );
                frame.setVisible ( true );
            }
        } );
    }
}

After pressing, dragging and releasing LMB over the divider it will be stuck:
image

As a reference - In default state split pane looks like this:
image

I've done a short investigation and it seems that earlier JDK 8 updates have some issues with dispatching events between components. It seems that they have added some workaround to components like JSplitPane in earlier updates not to get issues like the one I've displayed above, but in later versions they have also fixed something related to dispatching events so the bug is not present for older code either.

I'm not yet sure if I will be adding any changes to patch this up and whether I'm even able to patch it.

@mgarin mgarin added this to the JDK related milestone Mar 21, 2018
@mgarin mgarin self-assigned this Mar 21, 2018
@mgarin mgarin added this to Awaiting confirmation in JDK related Mar 21, 2018
@mgarin mgarin removed this from the JDK related milestone Apr 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
JDK related
Awaiting confirmation
Development

No branches or pull requests

1 participant