Tab/Dock Visual Notification

Hi Beni,

This is more of a “would be nice to have” question.

Lets say on the main JFrame, I have opened at least 5 docks in a CWorkingArea. Each dock will only have a JTable. For each dock, there will be a background thread running get information and updating the respect JTable using fireTableDataChanged method.

What I would like is if the dock is not in the foreground, then I would like some sort of animation of the dock tab to visually notify the user that information has changed for a JTable that is not the front dock.

Think of Firefox and a tab that plays sound then the tab shows a speaker icon. I don’t care if it is a blinking light or the tab shakes or the tab has some animation or whatever. I just want something so that the user knows a dock in the background has new information.


You could do things like changing the color of the tab, changing the font, or just the title (e.g. add a little star to the title).

// set a bold font
GenericFontModifier bold = new GenericFontModifier();
dockable.getFonts().setFont(FontMap.FONT_KEY_TAB, bold);
// set background color of tabs to red
dockable.getColors().setColor(ColorMap.COLOR_KEY_TAB_BACKGROUND, Color.RED);

// just add a '*' to the title
dockable.setTitleText( "title * ");```
Changing such properties takes immediate effect, even if a Dockable is already visible.

If you want an animation (e.g. switch the background color on and off) you would have to write it yourself. Just remember that any call to these methods should be done by the EDT, so either use `SwingUtilities.invokeLater` or use a `javax.swing.Timer`

You can always use `CControl.getFocusedDockable` to check which `CDockable` currently has the focus - you probably don't want it to send a notification if it receives new information. You can also use `CControl.addFocusListener` or `CDockable.addFocusListener` to get an event if a `CDockable` gains the focus (and remove its notification).