Cursor doesn't react (no resize indication)

Hello,

I’m implementing DockingFrames in my application. However, I don’t use it directly with a JFrame, but on a JPanel. It works perfectly, except for the resize cursor change on the edges of the docking frames.

Am I missing something?

Thanks in advance for your answer,

Hans Oesterholt.

Would you mind narrowing down the problem to a small, compilable, executable program source code? Could you please post this source code?

Best, Ebenius

I’ll make a small spike

I found the problem. Added comments where it occurs



import java.awt.CardLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;

import jdbcLayer.zc3SQLFactory;

import org.jdesktop.swingx.JXTaskPane;
import org.jdesktop.swingx.JXTaskPaneContainer;

import dataLayer.factory.zc3DataFactory;

import zc3.utils.zc3Config;

import bibliothek.extension.gui.dock.theme.EclipseTheme;
import bibliothek.gui.DockController;
import bibliothek.gui.DockTheme;
import bibliothek.gui.dock.DefaultDockable;
import bibliothek.gui.dock.SplitDockStation;
import bibliothek.gui.dock.station.split.SplitDockGrid;

import net.miginfocom.swing.MigLayout;


class taskAction extends AbstractAction {
    
    private static final long serialVersionUID = 1L;
    
    ActionListener _main=null;
    
    public taskAction(ActionListener main,String name,String desc,String command) {
        super(name);
        _main=main;
        putValue(SHORT_DESCRIPTION,desc);
        putValue(ACTION_COMMAND_KEY,command);
    }
    
    public void actionPerformed(ActionEvent e) {
        _main.actionPerformed(e);
    }
}

public class DockSpike {

    public static void main(String [] args) {
        
        
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
          } catch(Exception e) {
        }    
          
        
        SwingUtilities.invokeLater(new Runnable() {
            private JFrame _frame;
            private zc3DataFactory fact;
            
            private JPanel createPane(String t) {
                JPanel p=new JPanel();
                p.setLayout(new MigLayout("fill"));
                DockController controller=new DockController();
                DockTheme theme=new EclipseTheme();
                controller.setTheme(theme);
                SplitDockStation station=new SplitDockStation();
                //station.setContinousDisplay(true);
                controller.add(station);
                SplitDockGrid grid=new SplitDockGrid();
                {
                    DefaultDockable d=new DefaultDockable("N");
                    d.setTitleText(t+" North");
                    d.setLayout(new MigLayout("insets 0,fill"));
                    d.add(new JTextPane(),"growx,growy");
                    grid.addDockable(0, 0, 2, 1, d);
                }
                {
                    DefaultDockable d=new DefaultDockable("SW");
                    d.setTitleText(t+" South West");
                    d.setLayout(new MigLayout("insets 0,fill"));
                    d.add(new JTextPane(),"growx,growy");
                    grid.addDockable(0, 1, 1, 1, d);
                }
                {
                    DefaultDockable d=new DefaultDockable("SE");
                    d.setTitleText(t+" South Eeast");
                    d.setLayout(new MigLayout("insets 0,fill"));
                    d.add(new JTextPane(),"growx,growy");
                    grid.addDockable(1, 1, 1, 1, d);
                }
                station.dropTree(grid.toTree());
                p.add(station.getComponent(),"growx,growy");
                return p;
            }
            
            public void run() {
                
                _frame=new JFrame();
                _frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                
                zc3Config.setDataLocation("c:/zc3server/");
                zc3Config.setDb("zc3server");
                zc3Config.setAdminMode(true);

                try {
                    fact=new zc3SQLFactory();
                    fact.start();
                } catch (Exception E) {
                    System.out.println(E);
                    fact=null;
                }
                
                try {
                    JXTaskPaneContainer _tasks=new JXTaskPaneContainer();
                    JXTaskPane          _task1=new JXTaskPane();
                    _task1.setTitle("pane1");
                    JXTaskPane          _task2=new JXTaskPane();
                    _task2.setTitle("pane2");
                    final JPanel        _taskPanel=new JPanel();
                    final CardLayout    _taskLayout=new CardLayout();
                    _taskPanel.setLayout(_taskLayout);
                    
                    Action _selTask1Pane=new taskAction(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            _taskLayout.show(_taskPanel,"pane1");
                        }
                    },"Task1","","pane1");
                    Action _selTask2Pane=new taskAction(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            _taskLayout.show(_taskPanel,"pane2");
                        }
                    },"Task2","","pane2");
                    
                    _task1.add(_selTask1Pane);
                    _task2.add(_selTask2Pane);
                    _tasks.add(_task1);
                    _tasks.add(_task2);
                    
                    JPanel pane1=createPane("pane 1");
                    JPanel pane2=createPane("pane 2");
                    // HERE THE PROBLEM APPEARS, 
                    //        RESIZING STAYS ENABLED, WHILE
                    //         THE CURSOR INDICATION IS DISABLED.
                    pane2.setEnabled(false);
                    
                    _taskPanel.add(pane1,"pane1");
                    _taskPanel.add(pane2,"pane2");
                    
                    JPanel p=new JPanel();
                    MigLayout l=new MigLayout("fill","[][grow]","[grow]");
                    p.setLayout(l);
                    p.add(_tasks,"growy");
                    p.add(_taskPanel,"growx,growy");
                
                    _frame.add(p);
                    _frame.pack();
                    _frame.setSize(800,400);
                    _frame.setVisible(true);
                } catch (Exception E) {
                    System.out.println(E);
                }
            }
        });
    }
}```

I think you should make an implementation choice here.
E.g. document the behaviour

Yes, the framework does not support the disabled-enabled state in any way. I don’t have the spare time to implement this. You could however call “SplitDockStation.setResizingEnabled( false );” to stop the resizing.

If I may ask: do you need disabled stations and panels? And why do you need then?

I’ve pre created some panels that cannot be used unless other panels have been initialized, using menus (there are other possibilities to get the same functional result).