TableHeader: fixed missing trailing vertical separator line if used in upper left corner of scroll pane (issue #332)

This commit is contained in:
Karl Tauber
2021-09-14 00:52:59 +02:00
parent fd56de403d
commit fa194ec258
3 changed files with 14 additions and 2 deletions

View File

@@ -26,6 +26,8 @@ FlatLaf Change Log
regression since FlatLaf 1.4)
- TableHeader: Do not show resize cursor for last column if resizing last column
is not possible because auto resize mode of table is not off. (issue #332)
- TableHeader: Fixed missing trailing vertical separator line if used in upper
left corner of scroll pane. (issue #332)
- TextField, FormattedTextField, PasswordField and ComboBox: Fixed alignment of
placeholder text in right-to-left component orientation.
- Slider: Fixed calculation of baseline, which was wrong under some

View File

@@ -24,6 +24,7 @@ import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
import javax.swing.JViewport;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.table.JTableHeader;
@@ -112,12 +113,20 @@ public class FlatTableHeaderBorder
if( showLastVerticalLine )
return false;
// do not hide if table header is not a child of a scroll pane
Container viewport = header.getParent();
Container viewportParent = (viewport != null) ? viewport.getParent() : null;
if( !(viewportParent instanceof JScrollPane) )
return true;
return false;
JScrollBar vsb = ((JScrollPane)viewportParent).getVerticalScrollBar();
// do not hide if table header is not the column header of the scroll pane
JScrollPane scrollPane = (JScrollPane) viewportParent;
JViewport columnHeader = scrollPane.getColumnHeader();
if( viewport != columnHeader )
return false;
// hide if vertical scroll bar is not shown
JScrollBar vsb = scrollPane.getVerticalScrollBar();
if( vsb == null || !vsb.isVisible() )
return true;

View File

@@ -321,6 +321,7 @@ public class FlatTableUI
if( showLastVerticalLine )
return false;
// do not hide if table is not a child of a scroll pane
Container viewport = SwingUtilities.getUnwrappedParent( table );
Container viewportParent = (viewport != null) ? viewport.getParent() : null;
if( !(viewportParent instanceof JScrollPane) )