Where are the underlying components?

Hi Beni

We need to set properties on some components. Can you tell me how I can get hold of the color of the inactive title text and the background of the tabs (eclipse theme)?

Thank you very much
Daniela

For single Dockables: An easy solution in Common is to use CDockable.getColors(), then use the key “ColorMap.COLOR_KEY_TITLE_FOREGROUND” and “COLOR_KEY_TAB_BACKGROUND_…” to set some color.

For all Dockables the ColorScheme would be the appropriate place. Create (or write a subclass of) a scheme you would like to modify (e.g. EclipseColorScheme), then use the property-key of the theme whose scheme you want to update (e.g. EclipseTheme.ECLIPSE_COLOR_SCHEME) to install your scheme (CControl.setProperty(…)).

If you need more control over the colors, follow this thread.

And if you are using just Core, DockController.getColors() would be the starting point.

Please tell me if you need some example code, I’ll write it at the weekend.
****

I think you slightly misunderstood me. I’m sorry, I’ll try to clarify:
We use a LookAndFeel-library for our application which influences the colors of the dockables. To force the library to leave the colors alone and let us choose our own ones, we need to set a client property on the component, whose color we’re interested in.

Thus, to be able to put this client property, I need the component-object of the tab (to change background) and the label (of the title text) if there is one.

Thanks a lot
daniela

Ok. All tabs implement the interface “Tab” and are created by some “TabPane”. The easiest way to get to the tab is: override the method “createTab” each TabPane (FlatTabPane, BubbleTabPane, EclipseTabPane) offers. Then you can do anything you’d like with a newly created tab (maybe call “super.createTab”). Most Tabs just extend JPanel and add some additional Components to it. Traversing the Container/Components should not be a problem.

To use the new TabPane: implement a “StackDockComponentFactory” whose “create” method just creates and returns your TabPane. You can use “setStackDockComponentFactory” on any DockTheme to set the factory, or you can use the property-key “StackDockStation.COMPONENT_FACTORY” to install your factory directly.

Let me know if you need an example.

Can you add a protected method getLabel to OrientedLabel to return the DLabel? Otherwise subclasses cannot change the properties of the label…

thx a lot

No problem, the method will be available soon (hopefully within the next hour).

Sorry, I just noticed that its much easier to access the DLabel via the RectGradientPainter (I already extended the RectGradientPainter) but for that the getLabel method must be public instead of protected. Then I can simply call RectGradientPainter.getLabel().getLabel() and modify the DLabel as I needed.

Can you change the modifier from protected to public?
Thx a lot!

Hm, yes. What modifications do you need to make anyway?

I am using Substance. I have to set the colorization factor on the label directly otherwise the label’s background color is not correct.

dLabel.putClientProperty(SubstanceLookAndFeel.COLORIZATION_FACTOR, 1d);

I realize that this is an old thread, but we are looking at using DockingFrames with Substance. If Daniela (or anyone else) could give me an idea of how much effort it was to make them work together (and especially if there ended up being unsolvable conflicts) I would appreciate it. Thanks.

Rob