mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 06:27:13 -06:00
Table: replaced Table.showGrid with Table.showHorizontalLines and Table.showVerticalLines (issue #38)
This commit is contained in:
@@ -18,6 +18,8 @@ FlatLaf Change Log
|
|||||||
- ScrollPane with Table: The border of buttons that are added to one of the four
|
- ScrollPane with Table: The border of buttons that are added to one of the four
|
||||||
scroll pane corners are now removed if the center component is a table. Also,
|
scroll pane corners are now removed if the center component is a table. Also,
|
||||||
these corner buttons are made not focusable.
|
these corner buttons are made not focusable.
|
||||||
|
- Table: Replaced `Table.showGrid` with `Table.showHorizontalLines` and
|
||||||
|
`Table.showVerticalLines`. (issue #38)
|
||||||
|
|
||||||
|
|
||||||
## 0.23.1
|
## 0.23.1
|
||||||
|
|||||||
@@ -56,7 +56,8 @@ import com.formdev.flatlaf.util.UIScale;
|
|||||||
* <!-- FlatTableUI -->
|
* <!-- FlatTableUI -->
|
||||||
*
|
*
|
||||||
* @uiDefault Table.rowHeight int
|
* @uiDefault Table.rowHeight int
|
||||||
* @uiDefault Table.showGrid boolean
|
* @uiDefault Table.showHorizontalLines boolean
|
||||||
|
* @uiDefault Table.showVerticalLines boolean
|
||||||
* @uiDefault Table.intercellSpacing Dimension
|
* @uiDefault Table.intercellSpacing Dimension
|
||||||
* @uiDefault Table.selectionInactiveBackground Color
|
* @uiDefault Table.selectionInactiveBackground Color
|
||||||
* @uiDefault Table.selectionInactiveForeground Color
|
* @uiDefault Table.selectionInactiveForeground Color
|
||||||
@@ -72,7 +73,8 @@ import com.formdev.flatlaf.util.UIScale;
|
|||||||
public class FlatTableUI
|
public class FlatTableUI
|
||||||
extends BasicTableUI
|
extends BasicTableUI
|
||||||
{
|
{
|
||||||
protected boolean showGrid;
|
protected boolean showHorizontalLines;
|
||||||
|
protected boolean showVerticalLines;
|
||||||
protected Dimension intercellSpacing;
|
protected Dimension intercellSpacing;
|
||||||
|
|
||||||
protected Color selectionBackground;
|
protected Color selectionBackground;
|
||||||
@@ -102,7 +104,8 @@ public class FlatTableUI
|
|||||||
protected void installDefaults() {
|
protected void installDefaults() {
|
||||||
super.installDefaults();
|
super.installDefaults();
|
||||||
|
|
||||||
showGrid = UIManager.getBoolean( "Table.showGrid" );
|
showHorizontalLines = UIManager.getBoolean( "Table.showHorizontalLines" );
|
||||||
|
showVerticalLines = UIManager.getBoolean( "Table.showVerticalLines" );
|
||||||
intercellSpacing = UIManager.getDimension( "Table.intercellSpacing" );
|
intercellSpacing = UIManager.getDimension( "Table.intercellSpacing" );
|
||||||
|
|
||||||
selectionBackground = UIManager.getColor( "Table.selectionBackground" );
|
selectionBackground = UIManager.getColor( "Table.selectionBackground" );
|
||||||
@@ -116,10 +119,13 @@ public class FlatTableUI
|
|||||||
if( rowHeight > 0 )
|
if( rowHeight > 0 )
|
||||||
LookAndFeel.installProperty( table, "rowHeight", UIScale.scale( rowHeight ) );
|
LookAndFeel.installProperty( table, "rowHeight", UIScale.scale( rowHeight ) );
|
||||||
|
|
||||||
if( !showGrid ) {
|
if( !showHorizontalLines ) {
|
||||||
oldShowHorizontalLines = table.getShowHorizontalLines();
|
oldShowHorizontalLines = table.getShowHorizontalLines();
|
||||||
|
table.setShowHorizontalLines( false );
|
||||||
|
}
|
||||||
|
if( !showVerticalLines ) {
|
||||||
oldShowVerticalLines = table.getShowVerticalLines();
|
oldShowVerticalLines = table.getShowVerticalLines();
|
||||||
table.setShowGrid( false );
|
table.setShowVerticalLines( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( intercellSpacing != null ) {
|
if( intercellSpacing != null ) {
|
||||||
@@ -137,19 +143,15 @@ public class FlatTableUI
|
|||||||
selectionInactiveBackground = null;
|
selectionInactiveBackground = null;
|
||||||
selectionInactiveForeground = null;
|
selectionInactiveForeground = null;
|
||||||
|
|
||||||
// restore old show grid
|
// restore old show horizontal/vertical lines (if not modified)
|
||||||
if( !showGrid ) {
|
if( !showHorizontalLines && oldShowHorizontalLines && !table.getShowHorizontalLines() )
|
||||||
if( !table.getShowHorizontalLines() )
|
table.setShowHorizontalLines( true );
|
||||||
table.setShowHorizontalLines( oldShowHorizontalLines );
|
if( !showVerticalLines && oldShowVerticalLines && !table.getShowVerticalLines() )
|
||||||
if( !table.getShowVerticalLines() )
|
table.setShowVerticalLines( true );
|
||||||
table.setShowVerticalLines( oldShowVerticalLines );
|
|
||||||
}
|
|
||||||
|
|
||||||
// restore old intercell spacing
|
// restore old intercell spacing (if not modified)
|
||||||
if( intercellSpacing != null ) {
|
if( intercellSpacing != null && table.getIntercellSpacing().equals( intercellSpacing ) )
|
||||||
if( table.getIntercellSpacing().equals( intercellSpacing ) )
|
table.setIntercellSpacing( oldIntercellSpacing );
|
||||||
table.setIntercellSpacing( oldIntercellSpacing );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -369,7 +369,8 @@ TabbedPane.shadow=$ComboBox.buttonArrowColor
|
|||||||
#---- Table ----
|
#---- Table ----
|
||||||
|
|
||||||
Table.rowHeight=20
|
Table.rowHeight=20
|
||||||
Table.showGrid=false
|
Table.showHorizontalLines=false
|
||||||
|
Table.showVerticalLines=false
|
||||||
Table.intercellSpacing={dimension}0,0
|
Table.intercellSpacing={dimension}0,0
|
||||||
Table.scrollPaneBorder=com.formdev.flatlaf.ui.FlatBorder
|
Table.scrollPaneBorder=com.formdev.flatlaf.ui.FlatBorder
|
||||||
Table.ascendingSortIcon=com.formdev.flatlaf.icons.FlatAscendingSortIcon
|
Table.ascendingSortIcon=com.formdev.flatlaf.icons.FlatAscendingSortIcon
|
||||||
|
|||||||
Reference in New Issue
Block a user