mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-07 06:20:53 +03:00
List:
Some checks failed
CI / build (11, ) (push) Has been cancelled
CI / build (17, ) (push) Has been cancelled
CI / build (21, ) (push) Has been cancelled
CI / build (23, ) (push) Has been cancelled
CI / build (8, ) (push) Has been cancelled
CI / snapshot (push) Has been cancelled
CI / release (push) Has been cancelled
Some checks failed
CI / build (11, ) (push) Has been cancelled
CI / build (17, ) (push) Has been cancelled
CI / build (21, ) (push) Has been cancelled
CI / build (23, ) (push) Has been cancelled
CI / build (8, ) (push) Has been cancelled
CI / snapshot (push) Has been cancelled
CI / release (push) Has been cancelled
- fixed wrong x/width bounds of alternating rows for multi-column lists (PR #939) - Demo: added "alternating rows" checkboxes to "Data Components" page
This commit is contained in:
@@ -7,7 +7,8 @@ FlatLaf Change Log
|
|||||||
|
|
||||||
- CheckBox: Support styling indeterminate state of
|
- CheckBox: Support styling indeterminate state of
|
||||||
[tri-state check boxes](https://www.javadoc.io/doc/com.formdev/flatlaf-extras/latest/com/formdev/flatlaf/extras/components/FlatTriStateCheckBox.html).
|
[tri-state check boxes](https://www.javadoc.io/doc/com.formdev/flatlaf-extras/latest/com/formdev/flatlaf/extras/components/FlatTriStateCheckBox.html).
|
||||||
(issue #919)
|
(PR #936; issue #919)
|
||||||
|
- List: Support for alternate row highlighting. (PR #939)
|
||||||
- Tree: Support for alternate row highlighting. (PR #903)
|
- Tree: Support for alternate row highlighting. (PR #903)
|
||||||
- Tree: Support wide cell renderer. (issue #922)
|
- Tree: Support wide cell renderer. (issue #922)
|
||||||
- Extras: `FlatSVGIcon` color filters now can access painting component to
|
- Extras: `FlatSVGIcon` color filters now can access painting component to
|
||||||
|
|||||||
@@ -303,13 +303,24 @@ public class FlatListUI
|
|||||||
{
|
{
|
||||||
boolean isSelected = selModel.isSelectedIndex( row );
|
boolean isSelected = selModel.isSelectedIndex( row );
|
||||||
|
|
||||||
|
// paint alternating rows
|
||||||
|
if( alternateRowColor != null && row % 2 != 0 &&
|
||||||
|
!"ComboBox.list".equals( list.getName() ) ) // combobox does not support alternate row color
|
||||||
|
{
|
||||||
|
g.setColor( alternateRowColor );
|
||||||
|
|
||||||
|
float arc = UIScale.scale( selectionArc / 2f );
|
||||||
|
FlatUIUtils.paintSelection( (Graphics2D) g, rowBounds.x, rowBounds.y, rowBounds.width, rowBounds.height,
|
||||||
|
UIScale.scale( selectionInsets ), arc, arc, arc, arc, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
// get renderer component
|
// get renderer component
|
||||||
@SuppressWarnings( "unchecked" )
|
@SuppressWarnings( "unchecked" )
|
||||||
Component rendererComponent = cellRenderer.getListCellRendererComponent( list,
|
Component rendererComponent = cellRenderer.getListCellRendererComponent( list,
|
||||||
dataModel.getElementAt( row ), row, isSelected,
|
dataModel.getElementAt( row ), row, isSelected,
|
||||||
FlatUIUtils.isPermanentFocusOwner( list ) && (row == leadIndex) );
|
FlatUIUtils.isPermanentFocusOwner( list ) && (row == leadIndex) );
|
||||||
|
|
||||||
//
|
// use smaller cell width if list is used in JFileChooser
|
||||||
boolean isFileList = Boolean.TRUE.equals( list.getClientProperty( "List.isFileList" ) );
|
boolean isFileList = Boolean.TRUE.equals( list.getClientProperty( "List.isFileList" ) );
|
||||||
int cx, cw;
|
int cx, cw;
|
||||||
if( isFileList ) {
|
if( isFileList ) {
|
||||||
@@ -323,18 +334,6 @@ public class FlatListUI
|
|||||||
cw = rowBounds.width;
|
cw = rowBounds.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
// combobox does not support alternate row color
|
|
||||||
if( !"ComboBox.list".equals( list.getName() ) ) {
|
|
||||||
if( alternateRowColor != null && row % 2 != 0 ) {
|
|
||||||
g.setColor( alternateRowColor );
|
|
||||||
|
|
||||||
// paint respecting selection arc
|
|
||||||
float arc = UIScale.scale( selectionArc / 2f );
|
|
||||||
FlatUIUtils.paintSelection( (Graphics2D) g, 0, rowBounds.y, list.getWidth(), rowBounds.height,
|
|
||||||
UIScale.scale( selectionInsets ), arc, arc, arc, arc, 0 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// rounded selection or selection insets
|
// rounded selection or selection insets
|
||||||
if( isSelected &&
|
if( isSelected &&
|
||||||
!isFileList && // rounded selection is not supported for file list
|
!isFileList && // rounded selection is not supported for file list
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import java.awt.datatransfer.DataFlavor;
|
|||||||
import java.awt.datatransfer.StringSelection;
|
import java.awt.datatransfer.StringSelection;
|
||||||
import java.awt.datatransfer.Transferable;
|
import java.awt.datatransfer.Transferable;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import javax.swing.UIDefaults.ActiveValue;
|
||||||
import javax.swing.table.*;
|
import javax.swing.table.*;
|
||||||
import javax.swing.tree.*;
|
import javax.swing.tree.*;
|
||||||
import com.formdev.flatlaf.FlatClientProperties;
|
import com.formdev.flatlaf.FlatClientProperties;
|
||||||
@@ -65,6 +66,45 @@ class DataComponentsPanel
|
|||||||
tree3.putClientProperty( FlatClientProperties.STYLE, "selectionInsets: 0,1,0,1; selectionArc: 6" );
|
tree3.putClientProperty( FlatClientProperties.STYLE, "selectionInsets: 0,1,0,1; selectionArc: 6" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void listAlternatingRowsChanged() {
|
||||||
|
ActiveValue alternateRowColor = null;
|
||||||
|
if( listAlternatingRowsCheckBox.isSelected() ) {
|
||||||
|
alternateRowColor = table -> {
|
||||||
|
Color background = list1.getBackground();
|
||||||
|
return FlatLaf.isLafDark()
|
||||||
|
? ColorFunctions.lighten( background, 0.05f )
|
||||||
|
: ColorFunctions.darken( background, 0.05f );
|
||||||
|
};
|
||||||
|
}
|
||||||
|
UIManager.put( "List.alternateRowColor", alternateRowColor );
|
||||||
|
list1.updateUI();
|
||||||
|
list2.updateUI();
|
||||||
|
list3.updateUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void treeWideSelectionChanged() {
|
||||||
|
boolean wideSelection = treeWideSelectionCheckBox.isSelected();
|
||||||
|
tree1.putClientProperty( FlatClientProperties.TREE_WIDE_SELECTION, wideSelection );
|
||||||
|
tree2.putClientProperty( FlatClientProperties.TREE_WIDE_SELECTION, wideSelection );
|
||||||
|
tree3.putClientProperty( FlatClientProperties.TREE_WIDE_SELECTION, wideSelection );
|
||||||
|
}
|
||||||
|
|
||||||
|
private void treeAlternatingRowsChanged() {
|
||||||
|
ActiveValue alternateRowColor = null;
|
||||||
|
if( treeAlternatingRowsCheckBox.isSelected() ) {
|
||||||
|
alternateRowColor = table -> {
|
||||||
|
Color background = tree1.getBackground();
|
||||||
|
return FlatLaf.isLafDark()
|
||||||
|
? ColorFunctions.lighten( background, 0.05f )
|
||||||
|
: ColorFunctions.darken( background, 0.05f );
|
||||||
|
};
|
||||||
|
}
|
||||||
|
UIManager.put( "Tree.alternateRowColor", alternateRowColor );
|
||||||
|
tree1.updateUI();
|
||||||
|
tree2.updateUI();
|
||||||
|
tree3.updateUI();
|
||||||
|
}
|
||||||
|
|
||||||
private void dndChanged() {
|
private void dndChanged() {
|
||||||
boolean dnd = dndCheckBox.isSelected();
|
boolean dnd = dndCheckBox.isSelected();
|
||||||
DropMode dropMode = dnd ? DropMode.ON_OR_INSERT : DropMode.USE_SELECTION;
|
DropMode dropMode = dnd ? DropMode.ON_OR_INSERT : DropMode.USE_SELECTION;
|
||||||
@@ -142,18 +182,20 @@ class DataComponentsPanel
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void alternatingRowsChanged() {
|
private void alternatingRowsChanged() {
|
||||||
Color alternateRowColor = null;
|
ActiveValue alternateRowColor = null;
|
||||||
if( alternatingRowsCheckBox.isSelected() ) {
|
if( alternatingRowsCheckBox.isSelected() ) {
|
||||||
Color background = table1.getBackground();
|
alternateRowColor = table -> {
|
||||||
alternateRowColor = FlatLaf.isLafDark()
|
Color background = table1.getBackground();
|
||||||
? ColorFunctions.lighten( background, 0.05f )
|
return FlatLaf.isLafDark()
|
||||||
: ColorFunctions.darken( background, 0.05f );
|
? ColorFunctions.lighten( background, 0.05f )
|
||||||
|
: ColorFunctions.darken( background, 0.05f );
|
||||||
|
};
|
||||||
}
|
}
|
||||||
UIManager.put( "Table.alternateRowColor", alternateRowColor );
|
UIManager.put( "Table.alternateRowColor", alternateRowColor );
|
||||||
table1.repaint();
|
table1.repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings( { "unchecked", "rawtypes" } )
|
@SuppressWarnings( { "rawtypes" } )
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
|
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
|
||||||
JLabel label1 = new JLabel();
|
JLabel label1 = new JLabel();
|
||||||
@@ -166,6 +208,8 @@ class DataComponentsPanel
|
|||||||
list3 = new JList<>();
|
list3 = new JList<>();
|
||||||
JScrollPane scrollPane2 = new JScrollPane();
|
JScrollPane scrollPane2 = new JScrollPane();
|
||||||
list2 = new JList<>();
|
list2 = new JList<>();
|
||||||
|
JPanel listOptionsPanel = new JPanel();
|
||||||
|
listAlternatingRowsCheckBox = new JCheckBox();
|
||||||
JLabel treeLabel = new JLabel();
|
JLabel treeLabel = new JLabel();
|
||||||
JScrollPane scrollPane3 = new JScrollPane();
|
JScrollPane scrollPane3 = new JScrollPane();
|
||||||
tree1 = new JTree();
|
tree1 = new JTree();
|
||||||
@@ -173,6 +217,9 @@ class DataComponentsPanel
|
|||||||
tree3 = new JTree();
|
tree3 = new JTree();
|
||||||
JScrollPane scrollPane4 = new JScrollPane();
|
JScrollPane scrollPane4 = new JScrollPane();
|
||||||
tree2 = new JTree();
|
tree2 = new JTree();
|
||||||
|
JPanel treeOptionsPanel = new JPanel();
|
||||||
|
treeWideSelectionCheckBox = new JCheckBox();
|
||||||
|
treeAlternatingRowsCheckBox = new JCheckBox();
|
||||||
JLabel tableLabel = new JLabel();
|
JLabel tableLabel = new JLabel();
|
||||||
JScrollPane scrollPane5 = new JScrollPane();
|
JScrollPane scrollPane5 = new JScrollPane();
|
||||||
table1 = new JTable();
|
table1 = new JTable();
|
||||||
@@ -273,6 +320,22 @@ class DataComponentsPanel
|
|||||||
}
|
}
|
||||||
add(scrollPane2, "cell 3 1");
|
add(scrollPane2, "cell 3 1");
|
||||||
|
|
||||||
|
//======== listOptionsPanel ========
|
||||||
|
{
|
||||||
|
listOptionsPanel.setLayout(new MigLayout(
|
||||||
|
"insets 0,hidemode 3",
|
||||||
|
// columns
|
||||||
|
"[fill]",
|
||||||
|
// rows
|
||||||
|
"[]"));
|
||||||
|
|
||||||
|
//---- listAlternatingRowsCheckBox ----
|
||||||
|
listAlternatingRowsCheckBox.setText("alternating rows");
|
||||||
|
listAlternatingRowsCheckBox.addActionListener(e -> listAlternatingRowsChanged());
|
||||||
|
listOptionsPanel.add(listAlternatingRowsCheckBox, "cell 0 0");
|
||||||
|
}
|
||||||
|
add(listOptionsPanel, "cell 4 1");
|
||||||
|
|
||||||
//---- treeLabel ----
|
//---- treeLabel ----
|
||||||
treeLabel.setText("JTree:");
|
treeLabel.setText("JTree:");
|
||||||
add(treeLabel, "cell 0 2,aligny top,growy 0");
|
add(treeLabel, "cell 0 2,aligny top,growy 0");
|
||||||
@@ -334,6 +397,29 @@ class DataComponentsPanel
|
|||||||
}
|
}
|
||||||
add(scrollPane4, "cell 3 2");
|
add(scrollPane4, "cell 3 2");
|
||||||
|
|
||||||
|
//======== treeOptionsPanel ========
|
||||||
|
{
|
||||||
|
treeOptionsPanel.setLayout(new MigLayout(
|
||||||
|
"insets 0,hidemode 3",
|
||||||
|
// columns
|
||||||
|
"[fill]",
|
||||||
|
// rows
|
||||||
|
"[]0" +
|
||||||
|
"[]"));
|
||||||
|
|
||||||
|
//---- treeWideSelectionCheckBox ----
|
||||||
|
treeWideSelectionCheckBox.setText("wide selection");
|
||||||
|
treeWideSelectionCheckBox.setSelected(true);
|
||||||
|
treeWideSelectionCheckBox.addActionListener(e -> treeWideSelectionChanged());
|
||||||
|
treeOptionsPanel.add(treeWideSelectionCheckBox, "cell 0 0");
|
||||||
|
|
||||||
|
//---- treeAlternatingRowsCheckBox ----
|
||||||
|
treeAlternatingRowsCheckBox.setText("alternating rows");
|
||||||
|
treeAlternatingRowsCheckBox.addActionListener(e -> treeAlternatingRowsChanged());
|
||||||
|
treeOptionsPanel.add(treeAlternatingRowsCheckBox, "cell 0 1");
|
||||||
|
}
|
||||||
|
add(treeOptionsPanel, "cell 4 2");
|
||||||
|
|
||||||
//---- tableLabel ----
|
//---- tableLabel ----
|
||||||
tableLabel.setText("JTable:");
|
tableLabel.setText("JTable:");
|
||||||
add(tableLabel, "cell 0 3,aligny top,growy 0");
|
add(tableLabel, "cell 0 3,aligny top,growy 0");
|
||||||
@@ -379,7 +465,7 @@ class DataComponentsPanel
|
|||||||
{
|
{
|
||||||
TableColumnModel cm = table1.getColumnModel();
|
TableColumnModel cm = table1.getColumnModel();
|
||||||
cm.getColumn(2).setCellEditor(new DefaultCellEditor(
|
cm.getColumn(2).setCellEditor(new DefaultCellEditor(
|
||||||
new JComboBox(new DefaultComboBoxModel(new String[] {
|
new JComboBox<>(new DefaultComboBoxModel<>(new String[] {
|
||||||
"January",
|
"January",
|
||||||
"February",
|
"February",
|
||||||
"March",
|
"March",
|
||||||
@@ -394,7 +480,7 @@ class DataComponentsPanel
|
|||||||
"December"
|
"December"
|
||||||
}))));
|
}))));
|
||||||
cm.getColumn(3).setCellEditor(new DefaultCellEditor(
|
cm.getColumn(3).setCellEditor(new DefaultCellEditor(
|
||||||
new JComboBox(new DefaultComboBoxModel(new String[] {
|
new JComboBox<>(new DefaultComboBoxModel<>(new String[] {
|
||||||
"January",
|
"January",
|
||||||
"February",
|
"February",
|
||||||
"March",
|
"March",
|
||||||
@@ -513,9 +599,12 @@ class DataComponentsPanel
|
|||||||
private JList<String> list1;
|
private JList<String> list1;
|
||||||
private JList<String> list3;
|
private JList<String> list3;
|
||||||
private JList<String> list2;
|
private JList<String> list2;
|
||||||
|
private JCheckBox listAlternatingRowsCheckBox;
|
||||||
private JTree tree1;
|
private JTree tree1;
|
||||||
private JTree tree3;
|
private JTree tree3;
|
||||||
private JTree tree2;
|
private JTree tree2;
|
||||||
|
private JCheckBox treeWideSelectionCheckBox;
|
||||||
|
private JCheckBox treeAlternatingRowsCheckBox;
|
||||||
private JTable table1;
|
private JTable table1;
|
||||||
private JCheckBox roundedSelectionCheckBox;
|
private JCheckBox roundedSelectionCheckBox;
|
||||||
private JCheckBox showHorizontalLinesCheckBox;
|
private JCheckBox showHorizontalLinesCheckBox;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
JFDML JFormDesigner: "8.2.0.0.331" Java: "21" encoding: "UTF-8"
|
JFDML JFormDesigner: "8.3" encoding: "UTF-8"
|
||||||
|
|
||||||
new FormModel {
|
new FormModel {
|
||||||
contentType: "form/swing"
|
contentType: "form/swing"
|
||||||
@@ -92,6 +92,25 @@ new FormModel {
|
|||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 3 1"
|
"value": "cell 3 1"
|
||||||
} )
|
} )
|
||||||
|
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||||
|
"$layoutConstraints": "insets 0,hidemode 3"
|
||||||
|
"$columnConstraints": "[fill]"
|
||||||
|
"$rowConstraints": "[]"
|
||||||
|
} ) {
|
||||||
|
name: "listOptionsPanel"
|
||||||
|
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||||
|
name: "listAlternatingRowsCheckBox"
|
||||||
|
"text": "alternating rows"
|
||||||
|
auxiliary() {
|
||||||
|
"JavaCodeGenerator.variableLocal": false
|
||||||
|
}
|
||||||
|
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "listAlternatingRowsChanged", false ) )
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 0"
|
||||||
|
} )
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 4 1"
|
||||||
|
} )
|
||||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
name: "treeLabel"
|
name: "treeLabel"
|
||||||
"text": "JTree:"
|
"text": "JTree:"
|
||||||
@@ -192,6 +211,36 @@ new FormModel {
|
|||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 3 2"
|
"value": "cell 3 2"
|
||||||
} )
|
} )
|
||||||
|
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||||
|
"$layoutConstraints": "insets 0,hidemode 3"
|
||||||
|
"$columnConstraints": "[fill]"
|
||||||
|
"$rowConstraints": "[]0[]"
|
||||||
|
} ) {
|
||||||
|
name: "treeOptionsPanel"
|
||||||
|
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||||
|
name: "treeWideSelectionCheckBox"
|
||||||
|
"text": "wide selection"
|
||||||
|
"selected": true
|
||||||
|
auxiliary() {
|
||||||
|
"JavaCodeGenerator.variableLocal": false
|
||||||
|
}
|
||||||
|
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "treeWideSelectionChanged", false ) )
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 0"
|
||||||
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||||
|
name: "treeAlternatingRowsCheckBox"
|
||||||
|
"text": "alternating rows"
|
||||||
|
auxiliary() {
|
||||||
|
"JavaCodeGenerator.variableLocal": false
|
||||||
|
}
|
||||||
|
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "treeAlternatingRowsChanged", false ) )
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 1"
|
||||||
|
} )
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 4 2"
|
||||||
|
} )
|
||||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
name: "tableLabel"
|
name: "tableLabel"
|
||||||
"text": "JTable:"
|
"text": "JTable:"
|
||||||
|
|||||||
@@ -494,6 +494,11 @@ public class FlatComponents2Test
|
|||||||
list.setVisibleRowCount( visibleRowCount );
|
list.setVisibleRowCount( visibleRowCount );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void listAlternatingRowsChanged() {
|
||||||
|
UIManager.put( "List.alternateRowColor", listAlternatingRowsCheckBox.isSelected() ? Color.YELLOW : null );
|
||||||
|
FlatLaf.updateUILater();
|
||||||
|
}
|
||||||
|
|
||||||
private void treeRendererChanged() {
|
private void treeRendererChanged() {
|
||||||
Object sel = treeRendererComboBox.getSelectedItem();
|
Object sel = treeRendererComboBox.getSelectedItem();
|
||||||
if( !(sel instanceof String) )
|
if( !(sel instanceof String) )
|
||||||
@@ -530,6 +535,11 @@ public class FlatComponents2Test
|
|||||||
tree.putClientProperty( FlatClientProperties.TREE_WIDE_CELL_RENDERER, wideCellRenderer );
|
tree.putClientProperty( FlatClientProperties.TREE_WIDE_CELL_RENDERER, wideCellRenderer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void treeAlternatingRowsChanged() {
|
||||||
|
UIManager.put( "Tree.alternateRowColor", treeAlternatingRowsCheckBox.isSelected() ? Color.cyan : null );
|
||||||
|
FlatLaf.updateUILater();
|
||||||
|
}
|
||||||
|
|
||||||
private void treePaintSelectionChanged() {
|
private void treePaintSelectionChanged() {
|
||||||
boolean paintSelection = treePaintSelectionCheckBox.isSelected();
|
boolean paintSelection = treePaintSelectionCheckBox.isSelected();
|
||||||
for( JTree tree : allTrees )
|
for( JTree tree : allTrees )
|
||||||
@@ -670,12 +680,14 @@ public class FlatComponents2Test
|
|||||||
listLayoutOrientationField = new JComboBox<>();
|
listLayoutOrientationField = new JComboBox<>();
|
||||||
JLabel listVisibleRowCountLabel = new JLabel();
|
JLabel listVisibleRowCountLabel = new JLabel();
|
||||||
listVisibleRowCountSpinner = new JSpinner();
|
listVisibleRowCountSpinner = new JSpinner();
|
||||||
|
listAlternatingRowsCheckBox = new JCheckBox();
|
||||||
treeOptionsPanel = new JPanel();
|
treeOptionsPanel = new JPanel();
|
||||||
JLabel treeRendererLabel = new JLabel();
|
JLabel treeRendererLabel = new JLabel();
|
||||||
treeRendererComboBox = new JComboBox<>();
|
treeRendererComboBox = new JComboBox<>();
|
||||||
treeWideSelectionCheckBox = new JCheckBox();
|
treeWideSelectionCheckBox = new JCheckBox();
|
||||||
treeWideCellRendererCheckBox = new JCheckBox();
|
treeWideCellRendererCheckBox = new JCheckBox();
|
||||||
treePaintSelectionCheckBox = new JCheckBox();
|
treePaintSelectionCheckBox = new JCheckBox();
|
||||||
|
treeAlternatingRowsCheckBox = new JCheckBox();
|
||||||
treePaintLinesCheckBox = new JCheckBox();
|
treePaintLinesCheckBox = new JCheckBox();
|
||||||
treeRedLinesCheckBox = new JCheckBox();
|
treeRedLinesCheckBox = new JCheckBox();
|
||||||
treeEditableCheckBox = new JCheckBox();
|
treeEditableCheckBox = new JCheckBox();
|
||||||
@@ -737,7 +749,7 @@ public class FlatComponents2Test
|
|||||||
// rows
|
// rows
|
||||||
"[]" +
|
"[]" +
|
||||||
"[grow]" +
|
"[grow]" +
|
||||||
"[]" +
|
"[]0" +
|
||||||
"[]"));
|
"[]"));
|
||||||
|
|
||||||
//---- listLabel ----
|
//---- listLabel ----
|
||||||
@@ -780,7 +792,7 @@ public class FlatComponents2Test
|
|||||||
// rows
|
// rows
|
||||||
"[]" +
|
"[]" +
|
||||||
"[grow]" +
|
"[grow]" +
|
||||||
"[]" +
|
"[]0" +
|
||||||
"[]"));
|
"[]"));
|
||||||
|
|
||||||
//---- tableLabel ----
|
//---- tableLabel ----
|
||||||
@@ -817,7 +829,7 @@ public class FlatComponents2Test
|
|||||||
// rows
|
// rows
|
||||||
"[]" +
|
"[]" +
|
||||||
"[grow]" +
|
"[grow]" +
|
||||||
"[]" +
|
"[]0" +
|
||||||
"[]"));
|
"[]"));
|
||||||
|
|
||||||
//---- treeLabel ----
|
//---- treeLabel ----
|
||||||
@@ -1006,6 +1018,7 @@ public class FlatComponents2Test
|
|||||||
// rows
|
// rows
|
||||||
"[]" +
|
"[]" +
|
||||||
"[]" +
|
"[]" +
|
||||||
|
"[]" +
|
||||||
"[]"));
|
"[]"));
|
||||||
|
|
||||||
//---- listRendererLabel ----
|
//---- listRendererLabel ----
|
||||||
@@ -1043,6 +1056,11 @@ public class FlatComponents2Test
|
|||||||
listVisibleRowCountSpinner.setModel(new SpinnerNumberModel(8, 0, null, 1));
|
listVisibleRowCountSpinner.setModel(new SpinnerNumberModel(8, 0, null, 1));
|
||||||
listVisibleRowCountSpinner.addChangeListener(e -> listVisibleRowCountChanged());
|
listVisibleRowCountSpinner.addChangeListener(e -> listVisibleRowCountChanged());
|
||||||
listOptionsPanel.add(listVisibleRowCountSpinner, "cell 1 2");
|
listOptionsPanel.add(listVisibleRowCountSpinner, "cell 1 2");
|
||||||
|
|
||||||
|
//---- listAlternatingRowsCheckBox ----
|
||||||
|
listAlternatingRowsCheckBox.setText("alternating rows");
|
||||||
|
listAlternatingRowsCheckBox.addActionListener(e -> listAlternatingRowsChanged());
|
||||||
|
listOptionsPanel.add(listAlternatingRowsCheckBox, "cell 0 3 2 1,alignx left,growx 0");
|
||||||
}
|
}
|
||||||
add(listOptionsPanel, "cell 0 4 4 1");
|
add(listOptionsPanel, "cell 0 4 4 1");
|
||||||
|
|
||||||
@@ -1096,6 +1114,11 @@ public class FlatComponents2Test
|
|||||||
treePaintSelectionCheckBox.addActionListener(e -> treePaintSelectionChanged());
|
treePaintSelectionCheckBox.addActionListener(e -> treePaintSelectionChanged());
|
||||||
treeOptionsPanel.add(treePaintSelectionCheckBox, "cell 0 2");
|
treeOptionsPanel.add(treePaintSelectionCheckBox, "cell 0 2");
|
||||||
|
|
||||||
|
//---- treeAlternatingRowsCheckBox ----
|
||||||
|
treeAlternatingRowsCheckBox.setText("alternating rows");
|
||||||
|
treeAlternatingRowsCheckBox.addActionListener(e -> treeAlternatingRowsChanged());
|
||||||
|
treeOptionsPanel.add(treeAlternatingRowsCheckBox, "cell 0 2");
|
||||||
|
|
||||||
//---- treePaintLinesCheckBox ----
|
//---- treePaintLinesCheckBox ----
|
||||||
treePaintLinesCheckBox.setText("paint lines");
|
treePaintLinesCheckBox.setText("paint lines");
|
||||||
treePaintLinesCheckBox.addActionListener(e -> treePaintLinesChanged());
|
treePaintLinesCheckBox.addActionListener(e -> treePaintLinesChanged());
|
||||||
@@ -1253,11 +1276,13 @@ public class FlatComponents2Test
|
|||||||
private JComboBox<String> listRendererComboBox;
|
private JComboBox<String> listRendererComboBox;
|
||||||
private JComboBox<String> listLayoutOrientationField;
|
private JComboBox<String> listLayoutOrientationField;
|
||||||
private JSpinner listVisibleRowCountSpinner;
|
private JSpinner listVisibleRowCountSpinner;
|
||||||
|
private JCheckBox listAlternatingRowsCheckBox;
|
||||||
private JPanel treeOptionsPanel;
|
private JPanel treeOptionsPanel;
|
||||||
private JComboBox<String> treeRendererComboBox;
|
private JComboBox<String> treeRendererComboBox;
|
||||||
private JCheckBox treeWideSelectionCheckBox;
|
private JCheckBox treeWideSelectionCheckBox;
|
||||||
private JCheckBox treeWideCellRendererCheckBox;
|
private JCheckBox treeWideCellRendererCheckBox;
|
||||||
private JCheckBox treePaintSelectionCheckBox;
|
private JCheckBox treePaintSelectionCheckBox;
|
||||||
|
private JCheckBox treeAlternatingRowsCheckBox;
|
||||||
private JCheckBox treePaintLinesCheckBox;
|
private JCheckBox treePaintLinesCheckBox;
|
||||||
private JCheckBox treeRedLinesCheckBox;
|
private JCheckBox treeRedLinesCheckBox;
|
||||||
private JCheckBox treeEditableCheckBox;
|
private JCheckBox treeEditableCheckBox;
|
||||||
@@ -1363,7 +1388,7 @@ public class FlatComponents2Test
|
|||||||
@Override
|
@Override
|
||||||
public String getElementAt( int index ) {
|
public String getElementAt( int index ) {
|
||||||
return (index < 20)
|
return (index < 20)
|
||||||
? "item " + (index + 1)
|
? "item " + (index + 1) + ((index + 1) % 5 == 0 ? " ####" : "")
|
||||||
: "item " + (index + 1) + " " + randomRowString( index );
|
: "item " + (index + 1) + " " + randomRowString( index );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ new FormModel {
|
|||||||
} )
|
} )
|
||||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||||
"$columnConstraints": "[fill]"
|
"$columnConstraints": "[fill]"
|
||||||
"$rowConstraints": "[][grow][][]"
|
"$rowConstraints": "[][grow][]0[]"
|
||||||
"$layoutConstraints": "ltr,insets 0,hidemode 3"
|
"$layoutConstraints": "ltr,insets 0,hidemode 3"
|
||||||
} ) {
|
} ) {
|
||||||
name: "panel1"
|
name: "panel1"
|
||||||
@@ -95,7 +95,7 @@ new FormModel {
|
|||||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||||
"$layoutConstraints": "insets 0,hidemode 3"
|
"$layoutConstraints": "insets 0,hidemode 3"
|
||||||
"$columnConstraints": "[fill]"
|
"$columnConstraints": "[fill]"
|
||||||
"$rowConstraints": "[][grow][][]"
|
"$rowConstraints": "[][grow][]0[]"
|
||||||
} ) {
|
} ) {
|
||||||
name: "panel3"
|
name: "panel3"
|
||||||
"$client.FlatLaf.internal.testing.ignore": true
|
"$client.FlatLaf.internal.testing.ignore": true
|
||||||
@@ -146,7 +146,7 @@ new FormModel {
|
|||||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||||
"$layoutConstraints": "insets 0,hidemode 3"
|
"$layoutConstraints": "insets 0,hidemode 3"
|
||||||
"$columnConstraints": "[fill]"
|
"$columnConstraints": "[fill]"
|
||||||
"$rowConstraints": "[][grow][][]"
|
"$rowConstraints": "[][grow][]0[]"
|
||||||
} ) {
|
} ) {
|
||||||
name: "panel2"
|
name: "panel2"
|
||||||
"$client.FlatLaf.internal.testing.ignore": true
|
"$client.FlatLaf.internal.testing.ignore": true
|
||||||
@@ -385,7 +385,7 @@ new FormModel {
|
|||||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||||
"$layoutConstraints": "insets 8,hidemode 3"
|
"$layoutConstraints": "insets 8,hidemode 3"
|
||||||
"$columnConstraints": "[fill][fill]"
|
"$columnConstraints": "[fill][fill]"
|
||||||
"$rowConstraints": "[][][]"
|
"$rowConstraints": "[][][][]"
|
||||||
} ) {
|
} ) {
|
||||||
name: "listOptionsPanel"
|
name: "listOptionsPanel"
|
||||||
"border": new javax.swing.border.TitledBorder( "JList Control" )
|
"border": new javax.swing.border.TitledBorder( "JList Control" )
|
||||||
@@ -455,6 +455,16 @@ new FormModel {
|
|||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 1 2"
|
"value": "cell 1 2"
|
||||||
} )
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||||
|
name: "listAlternatingRowsCheckBox"
|
||||||
|
"text": "alternating rows"
|
||||||
|
auxiliary() {
|
||||||
|
"JavaCodeGenerator.variableLocal": false
|
||||||
|
}
|
||||||
|
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "listAlternatingRowsChanged", false ) )
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 3 2 1,alignx left,growx 0"
|
||||||
|
} )
|
||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 0 4 4 1"
|
"value": "cell 0 4 4 1"
|
||||||
} )
|
} )
|
||||||
@@ -527,6 +537,16 @@ new FormModel {
|
|||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 0 2"
|
"value": "cell 0 2"
|
||||||
} )
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||||
|
name: "treeAlternatingRowsCheckBox"
|
||||||
|
"text": "alternating rows"
|
||||||
|
auxiliary() {
|
||||||
|
"JavaCodeGenerator.variableLocal": false
|
||||||
|
}
|
||||||
|
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "treeAlternatingRowsChanged", false ) )
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 2"
|
||||||
|
} )
|
||||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||||
name: "treePaintLinesCheckBox"
|
name: "treePaintLinesCheckBox"
|
||||||
"text": "paint lines"
|
"text": "paint lines"
|
||||||
|
|||||||
Reference in New Issue
Block a user