Table and TableHeader: added UI defaults to show last vertical line (issue #332)

This commit is contained in:
Karl Tauber
2021-09-05 11:51:28 +02:00
parent c2c79c4676
commit 824db2e3bd
8 changed files with 21 additions and 1 deletions

View File

@@ -44,6 +44,7 @@ public class FlatTableHeaderBorder
{
protected Color separatorColor = UIManager.getColor( "TableHeader.separatorColor" );
protected Color bottomSeparatorColor = UIManager.getColor( "TableHeader.bottomSeparatorColor" );
protected boolean showLastVerticalLine = UIManager.getBoolean( "TableHeader.showLastVerticalLine" );
public FlatTableHeaderBorder() {
super( UIManager.getInsets( "TableHeader.cellMargins" ) );
@@ -108,6 +109,9 @@ public class FlatTableHeaderBorder
}
protected boolean hideTrailingVerticalLine( JTableHeader header ) {
if( showLastVerticalLine )
return false;
Container viewport = header.getParent();
Container viewportParent = (viewport != null) ? viewport.getParent() : null;
if( !(viewportParent instanceof JScrollPane) )

View File

@@ -62,6 +62,7 @@ import com.formdev.flatlaf.util.UIScale;
* @uiDefault TableHeader.cellMargins Insets
* @uiDefault TableHeader.separatorColor Color
* @uiDefault TableHeader.bottomSeparatorColor Color
* @uiDefault TableHeader.showLastVerticalLine boolean
*
* @author Karl Tauber
*/

View File

@@ -69,6 +69,7 @@ import com.formdev.flatlaf.util.UIScale;
* @uiDefault Table.rowHeight int
* @uiDefault Table.showHorizontalLines boolean
* @uiDefault Table.showVerticalLines boolean
* @uiDefault Table.showLastVerticalLine boolean
* @uiDefault Table.intercellSpacing Dimension
* @uiDefault Table.selectionInactiveBackground Color
* @uiDefault Table.selectionInactiveForeground Color
@@ -90,6 +91,7 @@ public class FlatTableUI
{
protected boolean showHorizontalLines;
protected boolean showVerticalLines;
protected boolean showLastVerticalLine;
protected Dimension intercellSpacing;
protected Color selectionBackground;
@@ -111,6 +113,7 @@ public class FlatTableUI
showHorizontalLines = UIManager.getBoolean( "Table.showHorizontalLines" );
showVerticalLines = UIManager.getBoolean( "Table.showVerticalLines" );
showLastVerticalLine = UIManager.getBoolean( "Table.showLastVerticalLine" );
intercellSpacing = UIManager.getDimension( "Table.intercellSpacing" );
selectionBackground = UIManager.getColor( "Table.selectionBackground" );
@@ -292,6 +295,9 @@ public class FlatTableUI
}
protected boolean hideLastVerticalLine() {
if( showLastVerticalLine )
return false;
Container viewport = SwingUtilities.getUnwrappedParent( table );
Container viewportParent = (viewport != null) ? viewport.getParent() : null;
if( !(viewportParent instanceof JScrollPane) )

View File

@@ -628,6 +628,7 @@ TabbedPane.closeCrossLineWidth = {float}1
Table.rowHeight = 20
Table.showHorizontalLines = false
Table.showVerticalLines = false
Table.showLastVerticalLine = false
Table.consistentHomeEndKeyBehavior = true
Table.intercellSpacing = {dimension}0,0
Table.scrollPaneBorder = com.formdev.flatlaf.ui.FlatBorder
@@ -657,7 +658,7 @@ TableHeader.cellBorder = com.formdev.flatlaf.ui.FlatTableHeaderBorder
TableHeader.cellMargins = 2,3,2,3
TableHeader.focusCellBackground = $TableHeader.background
TableHeader.background = @textComponentBackground
TableHeader.showLastVerticalLine = false
#---- TextArea ----