mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 06:27:13 -06:00
List, Table and Tree: item selection color of focused components no longer change from blue to gray when temporary loosing focus (e.g. showing a popup menu)
This commit is contained in:
@@ -1,6 +1,13 @@
|
||||
FlatLaf Change Log
|
||||
==================
|
||||
|
||||
## Unreleased
|
||||
|
||||
- List, Table and Tree: Item selection color of focused components no longer
|
||||
change from blue to gray when temporary loosing focus (e.g. showing a popup
|
||||
menu).
|
||||
|
||||
|
||||
## 0.30
|
||||
|
||||
- Windows: Fixed rendering of Unicode characters. Previously not all Unicode
|
||||
|
||||
@@ -106,7 +106,7 @@ public class FlatListUI
|
||||
@Override
|
||||
public void focusLost( FocusEvent e ) {
|
||||
super.focusLost( e );
|
||||
toggleSelectionColors( false );
|
||||
toggleSelectionColors( e.isTemporary() );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ public class FlatTableUI
|
||||
@Override
|
||||
public void focusLost( FocusEvent e ) {
|
||||
super.focusLost( e );
|
||||
toggleSelectionColors( false );
|
||||
toggleSelectionColors( e.isTemporary() );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Insets;
|
||||
import java.awt.KeyboardFocusManager;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
@@ -221,7 +222,7 @@ public class FlatTreeUI
|
||||
TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf )
|
||||
{
|
||||
boolean isEditing = (editingComponent != null && editingRow == row);
|
||||
boolean hasFocus = tree.hasFocus();
|
||||
boolean hasFocus = (KeyboardFocusManager.getCurrentKeyboardFocusManager().getPermanentFocusOwner() == tree);
|
||||
boolean cellHasFocus = hasFocus && (row == getLeadSelectionRow());
|
||||
boolean isSelected = tree.isRowSelected( row );
|
||||
boolean isDropRow = isDropRow( row );
|
||||
|
||||
@@ -81,6 +81,11 @@ class DataComponentsPanel
|
||||
JScrollPane scrollPane5 = new JScrollPane();
|
||||
table1 = new JTable();
|
||||
dndCheckBox = new JCheckBox();
|
||||
JPopupMenu popupMenu2 = new JPopupMenu();
|
||||
JMenuItem menuItem3 = new JMenuItem();
|
||||
JMenuItem menuItem4 = new JMenuItem();
|
||||
JMenuItem menuItem5 = new JMenuItem();
|
||||
JMenuItem menuItem6 = new JMenuItem();
|
||||
|
||||
//======== this ========
|
||||
setLayout(new MigLayout(
|
||||
@@ -126,6 +131,7 @@ class DataComponentsPanel
|
||||
@Override
|
||||
public String getElementAt(int i) { return values[i]; }
|
||||
});
|
||||
list1.setComponentPopupMenu(popupMenu2);
|
||||
scrollPane1.setViewportView(list1);
|
||||
}
|
||||
add(scrollPane1, "cell 1 0,growx");
|
||||
@@ -198,6 +204,7 @@ class DataComponentsPanel
|
||||
add(node1);
|
||||
}
|
||||
}));
|
||||
tree1.setComponentPopupMenu(popupMenu2);
|
||||
scrollPane3.setViewportView(tree1);
|
||||
}
|
||||
add(scrollPane3, "cell 1 1,growx");
|
||||
@@ -287,6 +294,7 @@ class DataComponentsPanel
|
||||
}))));
|
||||
}
|
||||
table1.setAutoCreateRowSorter(true);
|
||||
table1.setComponentPopupMenu(popupMenu2);
|
||||
scrollPane5.setViewportView(table1);
|
||||
}
|
||||
add(scrollPane5, "cell 1 2 2 1,growx,width 300");
|
||||
@@ -296,6 +304,27 @@ class DataComponentsPanel
|
||||
dndCheckBox.setMnemonic('D');
|
||||
dndCheckBox.addActionListener(e -> dndChanged());
|
||||
add(dndCheckBox, "cell 0 3 3 1");
|
||||
|
||||
//======== popupMenu2 ========
|
||||
{
|
||||
|
||||
//---- menuItem3 ----
|
||||
menuItem3.setText("Some Action");
|
||||
popupMenu2.add(menuItem3);
|
||||
|
||||
//---- menuItem4 ----
|
||||
menuItem4.setText("More Action");
|
||||
popupMenu2.add(menuItem4);
|
||||
popupMenu2.addSeparator();
|
||||
|
||||
//---- menuItem5 ----
|
||||
menuItem5.setText("No Action");
|
||||
popupMenu2.add(menuItem5);
|
||||
|
||||
//---- menuItem6 ----
|
||||
menuItem6.setText("Noop Action");
|
||||
popupMenu2.add(menuItem6);
|
||||
}
|
||||
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
||||
|
||||
((JComboBox)((DefaultCellEditor)table1.getColumnModel().getColumn( 3 ).getCellEditor()).getComponent()).setEditable( true );
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
JFDML JFormDesigner: "7.0.0.0.194" Java: "13.0.1" encoding: "UTF-8"
|
||||
JFDML JFormDesigner: "7.0.1.0.272" Java: "13.0.2" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
@@ -39,6 +39,7 @@ new FormModel {
|
||||
addElement( "item 14" )
|
||||
addElement( "item 15" )
|
||||
}
|
||||
"componentPopupMenu": new FormReference( "popupMenu2" )
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.typeParameters": "String"
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
@@ -143,6 +144,7 @@ new FormModel {
|
||||
} )
|
||||
} )
|
||||
} )
|
||||
"componentPopupMenu": new FormReference( "popupMenu2" )
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
@@ -299,6 +301,7 @@ new FormModel {
|
||||
add( null )
|
||||
} )
|
||||
"autoCreateRowSorter": true
|
||||
"componentPopupMenu": new FormReference( "popupMenu2" )
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
@@ -321,5 +324,29 @@ new FormModel {
|
||||
"location": new java.awt.Point( 0, 0 )
|
||||
"size": new java.awt.Dimension( 790, 715 )
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JPopupMenu", new FormLayoutManager( class javax.swing.JPopupMenu ) ) {
|
||||
name: "popupMenu2"
|
||||
add( new FormComponent( "javax.swing.JMenuItem" ) {
|
||||
name: "menuItem3"
|
||||
"text": "Some Action"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JMenuItem" ) {
|
||||
name: "menuItem4"
|
||||
"text": "More Action"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) {
|
||||
name: "separator1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JMenuItem" ) {
|
||||
name: "menuItem5"
|
||||
"text": "No Action"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JMenuItem" ) {
|
||||
name: "menuItem6"
|
||||
"text": "Noop Action"
|
||||
} )
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"location": new java.awt.Point( 0, 740 )
|
||||
} )
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user