mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 06:27:13 -06:00
ToolBar: disable focusability of buttons in toolbar
This commit is contained in:
@@ -4,6 +4,7 @@ FlatLaf Change Log
|
||||
## Unreleased
|
||||
|
||||
- ComboBox: Use small border if used as table editor.
|
||||
- ToolBar: Disable focusability of buttons in toolbar.
|
||||
|
||||
|
||||
## 0.13
|
||||
|
||||
@@ -19,6 +19,8 @@ package com.formdev.flatlaf.ui;
|
||||
import static com.formdev.flatlaf.util.UIScale.scale;
|
||||
import java.awt.Component;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ContainerEvent;
|
||||
import java.awt.event.ContainerListener;
|
||||
import javax.swing.AbstractButton;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.UIManager;
|
||||
@@ -53,6 +55,29 @@ public class FlatToolBarUI
|
||||
rolloverBorder = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ContainerListener createToolBarContListener() {
|
||||
return new ToolBarContListener() {
|
||||
@Override
|
||||
public void componentAdded( ContainerEvent e ) {
|
||||
super.componentAdded( e );
|
||||
|
||||
Component c = e.getChild();
|
||||
if( c instanceof AbstractButton )
|
||||
c.setFocusable( false );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentRemoved( ContainerEvent e ) {
|
||||
super.componentRemoved( e );
|
||||
|
||||
Component c = e.getChild();
|
||||
if( c instanceof AbstractButton )
|
||||
c.setFocusable( true );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Border createRolloverBorder() {
|
||||
return getRolloverBorder();
|
||||
|
||||
@@ -236,6 +236,7 @@ public class FlatInspector
|
||||
}
|
||||
}
|
||||
|
||||
text += "Focusable: " + c.isFocusable() + '\n';
|
||||
text += "Parent: " + c.getParent().getClass().getName();
|
||||
|
||||
return text;
|
||||
|
||||
Reference in New Issue
Block a user