Say you have a user interface with five or more tabs, and you need to inform the user that tab “2” needs attention.
Is there a way to do this? For example make the tab flash orange, or change the colour of the tab? I have had no success with requestFocus.
Edit: I am also interested in knowing how to force the focus on tab 2 if it ispossible.
You can achieve this by changing background and foreground of pane at position of tab using some timer. Just change it on some interval and it will look like its blinking. Here is a demo for this:
Here
1is the tab index which you want to blink. To stop blinking stop timer and set fore and background color to defaults.If you want to transfer focus to that tab you can use
setSelectedIndex(int index)method.Edit:-
As said by @perp in comment (also I have tested it and he is right) this will not work for look and feel other than WindowDefault. But the foreground color (text color) will still blink.