mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-27 03:46:17 -06:00
Tree and List: fixed painting of rounded drop backgrounds (issue #1023)
This commit is contained in:
@@ -162,6 +162,11 @@ public class FlatComponents2Test
|
||||
|
||||
for( JTree tree : allTrees )
|
||||
expandTree( tree );
|
||||
|
||||
// drop mode
|
||||
dropModeComboBox.init( DropMode.class, false );
|
||||
dropModeComboBox.setSelectedItem( DropMode.ON_OR_INSERT );
|
||||
dropModeChanged();
|
||||
}
|
||||
|
||||
private void initTableEditors( JTable table ) {
|
||||
@@ -311,13 +316,6 @@ public class FlatComponents2Test
|
||||
xTable1.setDragEnabled( dnd );
|
||||
xTreeTable1.setDragEnabled( dnd );
|
||||
|
||||
DropMode dropMode = dnd ? DropMode.ON_OR_INSERT : DropMode.USE_SELECTION;
|
||||
list1.setDropMode( dropMode );
|
||||
tree1.setDropMode( dropMode );
|
||||
table1.setDropMode( dropMode );
|
||||
xTable1.setDropMode( dropMode );
|
||||
xTreeTable1.setDropMode( dropMode );
|
||||
|
||||
String key = "FlatLaf.oldTransferHandler";
|
||||
if( dnd ) {
|
||||
list1.putClientProperty( key, list1.getTransferHandler() );
|
||||
@@ -341,6 +339,32 @@ public class FlatComponents2Test
|
||||
}
|
||||
}
|
||||
|
||||
private void dropModeChanged() {
|
||||
DropMode dropMode = dropModeComboBox.getSelectedValue();
|
||||
DropMode dropMode2;
|
||||
switch( dropMode ) {
|
||||
case INSERT_ROWS:
|
||||
case INSERT_COLS:
|
||||
dropMode2 = DropMode.INSERT;
|
||||
break;
|
||||
|
||||
case ON_OR_INSERT_ROWS:
|
||||
case ON_OR_INSERT_COLS:
|
||||
dropMode2 = DropMode.ON_OR_INSERT;
|
||||
break;
|
||||
|
||||
default:
|
||||
dropMode2 = dropMode;
|
||||
break;
|
||||
}
|
||||
|
||||
list1.setDropMode( dropMode2 );
|
||||
tree1.setDropMode( dropMode2 );
|
||||
table1.setDropMode( dropMode );
|
||||
xTable1.setDropMode( dropMode );
|
||||
xTreeTable1.setDropMode( dropMode );
|
||||
}
|
||||
|
||||
private void tableHeaderButtonChanged() {
|
||||
tableHeaderButtonChanged( table1ScrollPane );
|
||||
tableHeaderButtonChanged( xTable1ScrollPane );
|
||||
@@ -618,6 +642,7 @@ public class FlatComponents2Test
|
||||
super.updateUI();
|
||||
|
||||
EventQueue.invokeLater( () -> {
|
||||
dropModeChanged();
|
||||
showHorizontalLinesChanged();
|
||||
showVerticalLinesChanged();
|
||||
intercellSpacingChanged();
|
||||
@@ -673,6 +698,7 @@ public class FlatComponents2Test
|
||||
leftSelectionInsetsCheckBox = new JCheckBox();
|
||||
rightSelectionInsetsCheckBox = new JCheckBox();
|
||||
dndCheckBox = new JCheckBox();
|
||||
dropModeComboBox = new FlatTestEnumComboBox<>();
|
||||
listOptionsPanel = new JPanel();
|
||||
JLabel listRendererLabel = new JLabel();
|
||||
listRendererComboBox = new JComboBox<>();
|
||||
@@ -963,6 +989,7 @@ public class FlatComponents2Test
|
||||
"[]0" +
|
||||
"[]0" +
|
||||
"[]rel" +
|
||||
"[]" +
|
||||
"[]"));
|
||||
|
||||
//---- roundedSelectionCheckBox ----
|
||||
@@ -1004,6 +1031,10 @@ public class FlatComponents2Test
|
||||
dndCheckBox.setMnemonic('D');
|
||||
dndCheckBox.addActionListener(e -> dndChanged());
|
||||
generalOptionsPanel.add(dndCheckBox, "cell 0 4");
|
||||
|
||||
//---- dropModeComboBox ----
|
||||
dropModeComboBox.addActionListener(e -> dropModeChanged());
|
||||
generalOptionsPanel.add(dropModeComboBox, "cell 0 5");
|
||||
}
|
||||
add(generalOptionsPanel, "cell 0 4 4 1");
|
||||
|
||||
@@ -1272,6 +1303,7 @@ public class FlatComponents2Test
|
||||
private JCheckBox leftSelectionInsetsCheckBox;
|
||||
private JCheckBox rightSelectionInsetsCheckBox;
|
||||
private JCheckBox dndCheckBox;
|
||||
private FlatTestEnumComboBox<DropMode> dropModeComboBox;
|
||||
private JPanel listOptionsPanel;
|
||||
private JComboBox<String> listRendererComboBox;
|
||||
private JComboBox<String> listLayoutOrientationField;
|
||||
|
||||
@@ -299,7 +299,7 @@ new FormModel {
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "insets 8,hidemode 3"
|
||||
"$columnConstraints": "[left]"
|
||||
"$rowConstraints": "[][]0[]0[]rel[]"
|
||||
"$rowConstraints": "[][]0[]0[]rel[][]"
|
||||
} ) {
|
||||
name: "generalOptionsPanel"
|
||||
"border": new javax.swing.border.TitledBorder( "General Control" )
|
||||
@@ -379,6 +379,16 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 4"
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatTestEnumComboBox" ) {
|
||||
name: "dropModeComboBox"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
"JavaCodeGenerator.typeParameters": "DropMode"
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "dropModeChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 5"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 4 4 1"
|
||||
} )
|
||||
|
||||
Reference in New Issue
Block a user