Eclipse Theme 'Freeze' on MacOS


#1

I’ve only recently started playing with docking frames and it appears to be an incredible library - kudos for the great work!

However, I’ve noticed that on MacOS (Mojave at least) the Eclipse Theme is ‘freezing’ (i.e. wheel of death) whenever two SingleDockables are merged into a ‘tab’ with the eclipse theme.

Stripped down code demonstrating the behaviour is below:

import java.awt.Color;
import java.awt.GridLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import bibliothek.gui.dock.common.CControl;
import bibliothek.gui.dock.common.CLocation;
import bibliothek.gui.dock.common.DefaultSingleCDockable;
import bibliothek.gui.dock.common.SingleCDockable ;
import bibliothek.gui.dock.common.theme.ThemeMap;

public class BasicDockTest{
    public static void main( String [ ] args ) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException{
	    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        JFrame frame = new JFrame() ;
        frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
        CControl control = new CControl( frame ) ;
        control.setTheme(ThemeMap.KEY_ECLIPSE_THEME);

        frame.setLayout ( new GridLayout ( 1 , 1 ));
        frame.add( control.getContentArea ());
        SingleCDockable red = create("Red", Color.RED);
        SingleCDockable green = create("Green", Color.GREEN);
        SingleCDockable blue = create("Blue", Color.BLUE);
        control.addDockable( red );
        control.addDockable( green );
        control.addDockable( blue );

        red.setVisible ( true ) ;
        green.setLocation( CLocation.base().normalSouth( 0.6 ));
        green.setVisible ( true );
        blue.setLocation ( CLocation.base().normalEast( 0.3 ) );
        blue.setVisible( true );
        frame.setBounds ( 20, 20, 400, 400);
        frame.setVisible ( true );
    }
    public static SingleCDockable create ( String title , Color colour ) {
        JPanel background = new JPanel () ;
        background.setOpaque ( true ) ;
        background.setBackground( color );
        return new DefaultSingleCDockable( title , title , background );
    }
}

To demonstrate the problem just merge the green and red tabs into a single tab. Then toggle between the two dockables by selecting their two tabs (i.e. green and red tab). The app will then freeze and CPU load will go nuts for 10-30 seconds between each tab change.

This does not happen under Windows 10 or Linux.

Regards
Tom