Multi resolution icons

A dockable can have a title icon. Great!

When using a real JFrame for an externalized dockable (via DefaultScreenDockWindowFactory.setUndecorated(false) ) the title icon is used for the JFrame, even better!

Unfortunately title icons are usually 16x16 pixel only. But Windows (and possiby other OSs) use the icon of a JFrame in various places. In the Taskbar and the Window-Switcher [Alt]+[Tab]. In these places higher resolution icons are used, usually 32x32 and 48x48 pixels. If the current icon size doesn’t fit it, the icon will be up or down scaled with a loss of visual quality.

Therefore JFrame.setIconImages() exists where you can pass a list of icons in different resolutions (usually 16x16, 24x24, 32x32, 48x48 and 256x256 pixels).

So it would be great if a dockable could hold the same list of multiple resolution icons and passes these icon list to the JFrame. This way the best visual user experience would archived. Docking Frames themes would also benefit as it could pick the best fitting icon for their drawing. I could think of multiple resolution icons for Actions as well (plain Swing actions already support two icons, a small and a large one).

I am working for a multinational company in the financial industry and we just deleted our NetBeans Platform branch and ported all our apps to Docking Frames!

Benni, you did a really great job with Docking Frames.
Could you please add multi resolution icons, at least for the title icon :slight_smile:

Thanks!

Just found that it isn’t that simple, since you can have multiple dockables in the externalised JFrame. I would suggest to change the JFrame icons to the current active dockable.

In the meanwhile I’ve found a way to capture events where I can set the JFrame icons by myself.

Nevertheless I think it is a nice enhancement and should find its way on the TODO list.

I like the idea with the multi-size icons, it is surely on the todo list.

The icon of the exteranliced frame… it is a design decision behind it. The frame does not know that it has “multiple” children, it only knows of one Dockable - the StackDockStation that features tabs. And having the DockStation update its icon based on focus is a bit tricky :-/ . I guess most people would prefere to show the global application-icon anyways.

Thanks Benni,

I have added a FocusListener to each externalized dockable and update the belonging JFrame icon(s) if the dockable gets the focus, works quite well!

Another question, I am trying nested docking. While it technically works it is visually confusing for the user. Is it possible to paint the outer main-dockables with a different theme than the inner sub-dockabels?

In other words, is it possible to assign certain stations/areas a different docking theme?

import bibliothek.gui.dock.common.CContentArea;
import bibliothek.gui.dock.common.CControl;
import bibliothek.gui.dock.common.CGrid;
import bibliothek.gui.dock.common.DefaultSingleCDockable;
import bibliothek.gui.dock.common.action.CAction;

import javax.swing.*;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class MultipleDockingTabs extends JFrame
{
	private CControl m_control;

	public MultipleDockingTabs() throws HeadlessException
	{
		setDefaultCloseOperation( WindowConstants.EXIT_ON_CLOSE );
		initDocking();

		MainDock main1 = new MainDock( "main 1" );
		MainDock main2 = new MainDock( "main 2" );

		CGrid gridMain = new CGrid( null );
		gridMain.add( 0, 0, 50, 50, main1 );
		gridMain.add( 0, 0, 50, 50, main2 );
		m_control.getContentArea().deploy( gridMain );

		setBounds( 0, 0, 1280, 786 );
	}

	protected void initDocking()
	{
		// add the actual dock controller
		m_control = new CControl( this );
		add( m_control.getContentArea() );
		addWindowListener( new WindowAdapter()
		{
			@Override
			public void windowClosed( WindowEvent e )
			{
				m_control.destroy();
			}
		} );

		m_control.setTheme( "eclipse" );

	}

	private class MainDock extends DefaultSingleCDockable
	{
		private CContentArea m_area;

		public MainDock( String title, CAction... actions )
		{
			super( title, title, actions );
			CContentArea m_area = m_control.createContentArea( "area"+title );
			getContentPane().add( m_area );
			m_control.addDockable( this );

			DefaultSingleCDockable sub1 = getSubDock( title+"sub1", "sub 1" );
			DefaultSingleCDockable sub2 = getSubDock( title+"sub2", "sub 2" );

			CGrid grid = new CGrid( null );
			grid.add( 0, 0, 1, 1, sub1 );
			grid.add( 0, 1, 1, 1, sub2 );
			m_area.deploy( grid );
		}

		private DefaultSingleCDockable getSubDock( String id, String title )
		{
			DefaultSingleCDockable result = new DefaultSingleCDockable( id, title );
			m_control.addDockable( result );
			result.setExternalizable( false );
			m_area.getCenter().addDockable( result.intern() );
			return result;
		}
	}

	public static void main( String[] args )
	{
		EventQueue.invokeLater( new Runnable()
		{
			@Override
			public void run()
			{
					new MultipleDockingTabs().setVisible( true );
			}
		} );
	}


}

No, there is exactly one theme per CControl. You may use a different CControl for the inner Dockables, but that has some side effects like reduced drag and drop possibilities.

But each CDockable has a method “getColors”, which returns a Map. You can fill in some colors into that map, and that will make the titles/tabs of inner tabs look slightly different.

I just wanted to add, that CContentArea really was not designed to be used the way you use it. The more secure way to add some nesting, is to create a CGridArea or a CWorkingArea and use that object directly like any other CDockable.

In order to handle visibility, drag and drop, and focus, the framework needs to know of the relationship between Dockables and parent "DockStation"s. Using “java.awt.Container.add(…)” will not tell framework, that one Dockable is a child of another one - it will only create confusion.