StackDockStation displays the title and icons of its dockable by default

Hi,

I need by default to display an icon and a text for all dockables in a StackDockStation
Is there any property to set? or I should use the TabContentFilter? Could you please advice?

import java.awt.BorderLayout;
import java.awt.Color;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.WindowConstants;

import bibliothek.extension.gui.dock.theme.EclipseTheme;

import bibliothek.gui.DockController;
import bibliothek.gui.dock.DefaultDockable;
import bibliothek.gui.dock.StackDockStation;


/*
 * There are various themes which can be used. This demo shows
 * how to include them.
 */

public class Demo03_Theme {

    public Demo03_Theme() {
        // create a frame
        JFrame frame = new JFrame("Demo");
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        frame.setSize(600, 500);

        DockController controller = new DockController();
        controller.setTheme(new EclipseTheme());
        // some stations
        StackDockStation station = new StackDockStation();
        frame.add(station.getComponent(), BorderLayout.CENTER);
        controller.add(station);

        // create two panels
        JPanel black = new JPanel();
        black.setBackground(Color.BLACK);
        black.setOpaque(true);

        JPanel green = new JPanel();
        green.setBackground(Color.GREEN);
        green.setOpaque(true);
        DefaultDockable blackDockable = new DefaultDockable(black, "Black");
        blackDockable.setTitleIcon(new ImageIcon(getClass().getClassLoader().getResource("demo/flap_south.png")));
        station.drop(blackDockable);
        station.drop(new DefaultDockable(green, "Green"));

        frame.setVisible(true);
    }


    public static void main(String[] args) {
        new Demo03_Theme();
    }
}

Thank you,

Per default the StackDockStation shows exactly the title-text and icon that is specified by the Dockable (Dockable.getTitleText/getTitleIcon). You can change that only with a TabContentFilter.

(… and you’ll need to download the framework directly from the SVN server and compile it yourself, because I did not yet put up a new release: http://svn.javaforge.com/svn/DockingFrames, user=anonymous, pw=anon ).

Hi,

Is it a good way to make it like that?

controller.getProperties().set(EclipseTheme.PAINT_ICONS_WHEN_DESELECTED, true);

Thank you,

If you don’t need to change the icon or text, then this should work (the other themes do not hide icons in deselected tabs).

Thank you