I’ve been playing around with Docking Frames for a few days now, and it looks like a great library.
However, I have been having a hard time figuring out how to do exactly what I’m looking for.
Basically, I have a system with a main window (which doesn’t/shouldn’t have any Docking Frames features). this main window, however, should have some variable number of sub windows, which should use Docking Frame’s features (similar to how GIMP works, with a main area that users edit, and a variable number of dockable components that users can drag around to various sub windows).
I’ve been playing around with the Splitting Externalized Dockables example, as it seems to more or less do what I want. However, two questions have arisen from that:
is there any way to add the Initial SingleCDockables to externalized windows, without them ever being a part of the frame
is there a way to not allow Dockables to be added to the Main Frame?
Sorry if my question is a little vague, but I’m not sure how else to phrase it.
You could simply not create the “main panel”, like in the example below.
But it is a case that works “by accident”, the framework is not really designed to work without main panel. Personally I would create one main frame with docking capabilities and not use the “Splitting Externalized Dockables example” - it is too confusing for users. You could easily create a “main Dockable” that has no title and that cannot be moved away from the “main frame”.
import javax.swing.JFrame;
import bibliothek.gui.dock.common.CControl;
import bibliothek.gui.dock.common.CLocation;
import bibliothek.gui.dock.common.DefaultSingleCDockable;
public class ExternalOnly {
public static void main( String[] args ) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.setBounds( 20, 20, 800, 800 );
CControl control = new CControl( frame );
// usually "normalized" is the default mode that is always present. Clients need to create subclasses
// to override this property (we really do not want to override this property by accident)
DefaultSingleCDockable dockable = new DefaultSingleCDockable( "id", "Something" ){
@Override
public boolean isNormalizeable() {
return false;
}
};
dockable.setMinimizable( false );
dockable.setLocation( CLocation.external( 60, 60, 300, 150 ) );
control.addDockable( dockable );
dockable.setVisible( true );
frame.setVisible( true );
}
}
I decided you were right about the example being too confusing, and decided to go with a dialog window with some dockables not able to be move, and others which can.