There is no built-in property or method for this.
One option is to create a custom JLabel (or other component), add a MouseListener that will change the color of the mouse input / output.
Example: Example:
class CustomMouseOverJLabel extends JLabel{
public CustomMouseOverJLabel(String text) {
super(text);
addMouseListener(new MouseAdapter(){
@Override
public void mouseEntered(MouseEvent e) {
setForeground(Color.BLUE);
}
@Override
public void mouseExited(MouseEvent e) {
setForeground(Color.RED);
}
});
}
}
Then, when you make an addTab call (name, element), you also set custom header components, for example:
yourTabbedPane.setTabComponentAt(index, new CustomMouseOverJLabel("title"));
source
share