mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-12 15:07:11 -06:00
TableHeader: Moved table header column border painting from FlatTableHeaderUI to new border FlatTableHeaderBorder to improve compatibility with custom table header implementations (issue #228)
This commit is contained in:
@@ -40,6 +40,7 @@ import javax.swing.tree.DefaultTreeCellRenderer;
|
||||
import javax.swing.tree.DefaultTreeModel;
|
||||
import javax.swing.tree.TreeCellRenderer;
|
||||
import com.formdev.flatlaf.FlatClientProperties;
|
||||
import com.formdev.flatlaf.FlatLaf;
|
||||
import com.formdev.flatlaf.icons.FlatMenuArrowIcon;
|
||||
import com.formdev.flatlaf.util.UIScale;
|
||||
import com.jidesoft.swing.*;
|
||||
@@ -193,6 +194,15 @@ public class FlatComponents2Test
|
||||
table.setAutoResizeMode( autoResizeMode );
|
||||
}
|
||||
|
||||
private void sortIconPositionChanged() {
|
||||
Object sel = sortIconPositionComboBox.getSelectedItem();
|
||||
if( "right".equals( sel ) )
|
||||
sel = null;
|
||||
|
||||
UIManager.put( "TableHeader.sortIconPosition", sel );
|
||||
FlatLaf.updateUILater();
|
||||
}
|
||||
|
||||
private void dndChanged() {
|
||||
boolean dnd = dndCheckBox.isSelected();
|
||||
list1.setDragEnabled( dnd );
|
||||
@@ -442,6 +452,8 @@ public class FlatComponents2Test
|
||||
JPanel tableOptionsPanel = new JPanel();
|
||||
JLabel autoResizeModeLabel = new JLabel();
|
||||
autoResizeModeField = new JComboBox<>();
|
||||
JLabel sortIconPositionLabel = new JLabel();
|
||||
sortIconPositionComboBox = new JComboBox<>();
|
||||
showHorizontalLinesCheckBox = new JCheckBox();
|
||||
rowSelectionCheckBox = new JCheckBox();
|
||||
showVerticalLinesCheckBox = new JCheckBox();
|
||||
@@ -753,6 +765,20 @@ public class FlatComponents2Test
|
||||
autoResizeModeField.addActionListener(e -> autoResizeModeChanged());
|
||||
tableOptionsPanel.add(autoResizeModeField, "cell 0 0 2 1");
|
||||
|
||||
//---- sortIconPositionLabel ----
|
||||
sortIconPositionLabel.setText("Sort icon:");
|
||||
tableOptionsPanel.add(sortIconPositionLabel, "cell 0 0 2 1");
|
||||
|
||||
//---- sortIconPositionComboBox ----
|
||||
sortIconPositionComboBox.setModel(new DefaultComboBoxModel<>(new String[] {
|
||||
"right",
|
||||
"left",
|
||||
"top",
|
||||
"bottom"
|
||||
}));
|
||||
sortIconPositionComboBox.addActionListener(e -> sortIconPositionChanged());
|
||||
tableOptionsPanel.add(sortIconPositionComboBox, "cell 0 0 2 1");
|
||||
|
||||
//---- showHorizontalLinesCheckBox ----
|
||||
showHorizontalLinesCheckBox.setText("show horizontal lines");
|
||||
showHorizontalLinesCheckBox.addActionListener(e -> showHorizontalLinesChanged());
|
||||
@@ -819,6 +845,7 @@ public class FlatComponents2Test
|
||||
private JCheckBox treeWideSelectionCheckBox;
|
||||
private JCheckBox treePaintSelectionCheckBox;
|
||||
private JComboBox<String> autoResizeModeField;
|
||||
private JComboBox<String> sortIconPositionComboBox;
|
||||
private JCheckBox showHorizontalLinesCheckBox;
|
||||
private JCheckBox rowSelectionCheckBox;
|
||||
private JCheckBox showVerticalLinesCheckBox;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
JFDML JFormDesigner: "7.0.3.1.342" Java: "15" encoding: "UTF-8"
|
||||
JFDML JFormDesigner: "7.0.3.1.342" Java: "16" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
@@ -398,6 +398,28 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0 2 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "sortIconPositionLabel"
|
||||
"text": "Sort icon:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0 2 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JComboBox" ) {
|
||||
name: "sortIconPositionComboBox"
|
||||
"model": new javax.swing.DefaultComboBoxModel {
|
||||
selectedItem: "right"
|
||||
addElement( "right" )
|
||||
addElement( "left" )
|
||||
addElement( "top" )
|
||||
addElement( "bottom" )
|
||||
}
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "sortIconPositionChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0 2 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "showHorizontalLinesCheckBox"
|
||||
"text": "show horizontal lines"
|
||||
@@ -484,7 +506,7 @@ new FormModel {
|
||||
} )
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"location": new java.awt.Point( 0, 0 )
|
||||
"size": new java.awt.Dimension( 950, 600 )
|
||||
"size": new java.awt.Dimension( 1000, 600 )
|
||||
} )
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user