DockController, DockFrontend, CController what should i use?

Hi all, i’am new to DockingFrames. I try to port my app from mydoggy to DockingFrames. I’ve read some example code, documentation and looked at the example project that come with DockingFrames. And now… i’am confused :wink:
DockController, DockFrontend, CController what should i use?

I have a very simple app: I want a area on left for a „navigator“ and a working area on the right that contains 1…n DefaultSingleCDockable
… oh and a minimized area at the bottom that content i want to create delayed.
I am starting with CController but i did not make it to build my layout this way.

Please give me a example code to build my simple layout. Thanks!

Andreas

You should use CControl, because that one is from the Common project. The others are from the Core project, which you should not use directly if possible.

You might also want to check out the “Editors” example (search for the class “MultipleDockables”) from the tutorial project. It explains the preferred way to open several dockables showing “documents” (e.g. web pages, text documents, etc…).

As for the example. I don’t remember in which thread I used this one, but it is close to what you want to build:


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

import javax.swing.JButton;
import javax.swing.JFrame;

import bibliothek.gui.dock.common.CControl;
import bibliothek.gui.dock.common.CGrid;
import bibliothek.gui.dock.common.CWorkingArea;
import bibliothek.gui.dock.common.DefaultSingleCDockable;
import bibliothek.gui.dock.common.SingleCDockable;

public class Dock21 {
	public static void main( String[] args ){
		JFrame frame = new JFrame();
		final CControl control = new CControl( frame );
		frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
		
		frame.add( control.getContentArea() );

		CGrid grid = new CGrid( control );
		final CWorkingArea work = control.createWorkingArea( "work" );
		
		grid.add( 0, 0, 1, 1, create( "a", "Aaaa" ) );
		grid.add( 0, 1, 1, 1, create( "b", "Bbbb" ) );
		grid.add( 1, 0, 1, 1, work );
		
		control.getContentArea().deploy( grid );
		
		JButton add = new JButton( "Add" );
		frame.add( add, BorderLayout.SOUTH );
		add.addActionListener( new ActionListener(){
			private int count = 0;
			@Override
			public void actionPerformed( ActionEvent e ){
				String title = "T " + (count++);
				SingleCDockable dockable = create( title, title );
				work.show( dockable );
				// or: control.addDockable, dockable.setLocation( CLocation.<location> ), dockable.setVisible
			}
		} );
		
		frame.setBounds( 20, 20, 400, 400 );
		frame.setVisible( true );
	}
	
	private static SingleCDockable create(String key, String title){
		DefaultSingleCDockable dockable = new DefaultSingleCDockable( key, title );
		JButton button = new JButton( "test" );
		dockable.add( button );
		dockable.setFocusComponent( button );
		return dockable;
	}
}

Thanks for your quick helP! Your demo help me a lot to get what i want. I’ve made the next step :wink:
Some little thing: It looks that CWorkingArea has no show( dockable ) method?!

Andreas

show only exists since version 1.1.1p7b, so maybe you require an update?