Changing borders of flap- and screen-stations

Hi everybody,

first I’d like to say a big "THANK YOU’ to Beni for this great piece of code.

I’m (almost) a newbie to swing and an absolute newbie to DF, and I’m doing my first non-trivial app in Swing. For that I want to use DF and created a new theme, that uses very little borders, reduces virtual lines and won’t alienate neither win- nor mac-users (please find a screenshot attached). Since I draw my own borders, I’d like to change the bevel-borders of flap-dock-station and screen-dock-station to empty-borders. How do I achieve this?

Thank you in advance, Marc

Currently the border of the FlapWindow (the window shown by the flap-dock-station) cannot be changed.

For the ScreenDockStation a new ScreenDockWindowFactory will be necessary (use the key ScreenDockStation.WINDOW_FACTORY to globally replace the factory). If for example the new factory creates a ScreenDockDialog, then you could remove the border once the dialog is created.

But instead of writing workarounds I can include some real support for borders in the next release.

P.S. looks nice what you already have, if you are interested we could add it as extension to the library.
P.P.S. I’m rewriting some code concerning tabs right now (* , and I fear your tabs will need some upgrades if the theme should work properly with 1.0.8

(* meaning 1.0.8p1 has already most of the modifications included

Thanks for your quick reply!

I’m currently working with 1.0.7 - maybe I’ll check 1.0.8 at a later date.

Some things in my theme are not done very elegantly (e.g. colors are hard-coded, though it could be easily changed) and I still have no idea how to do the mouse-over-effect on icons (the regular border-effect doesn’t look good in this theme), but apart from that it’s fine for me to add it as an extension. Maybe more via PM (and in German :wink: )?

Well I would at least like to have a look at the code. German would be easier :stuck_out_tongue: , if it’s ok for you I prefer e-mail (benjamin_sigg@gmx.ch).

Can the border of a FlapWindow be changed in the latest version?

I just added the feature :wink: It will be available in version 1.1.2p4 (which I upload within the next week).

In 1.1.2p4 you will be able to replace the border with this piece of code. (In the current version 1.1.2p3 this code has no effect)


import java.awt.Color;

import bibliothek.gui.dock.common.CControl;
import bibliothek.gui.dock.common.DefaultSingleCDockable;
import bibliothek.gui.dock.themes.ThemeManager;
import bibliothek.gui.dock.themes.border.BorderModifier;

import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.border.Border;

public class FlapWindowTest {
	public static void main( String[] args ){
		JFrame frame = new JFrame();
		frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
		frame.setBounds( 20, 20, 440, 400 );
		
		CControl control = new CControl( frame );
		frame.add( control.getContentArea() );
		
		ThemeManager theme = control.getController().getThemeManager();
		BorderModifier modifier = new BorderModifier(){
			@Override
			public Border modify( Border border ){
				return BorderFactory.createLineBorder( Color.RED, 5 );
			}
		};
		theme.setBorderModifier( ThemeManager.BORDER_MODIFIER + ".flap.window", modifier );
		
		DefaultSingleCDockable dockable = new DefaultSingleCDockable( "bla", "Bla bla" );
		control.addDockable( dockable );
		dockable.setVisible( true );
		
		frame.setVisible( true );
	}
}