JDK-8089280 : horizontal scrollbar should never become visible in TableView with constrained resize policy
  • Type: Bug
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: fx2.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2011-07-08
  • Updated: 2023-09-05
  • Resolved: 2022-09-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
jfx17.0.9Fixed
Related Reports
Blocks :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
This tends to happen when the table is resized. 

edit 2022/09/09:
This issue has been partially fixed by JDK-8089009 which addressed horizontal scroll bar (HSB) flicker.  However, when the tree/table contains columns with the minimum width(s) set, the HSB appears again because the logic that controls HSB visibility is not aware of the fact that a constrained resize policy is in effect.
Comments
A pull request was submitted for review. URL: https://git.openjdk.org/jfx17u/pull/148 Date: 2023-09-04 09:10:18 +0000
04-09-2023

Changeset: 5e4552db Author: Andy Goryachev <angorya@openjdk.org> Committer: Kevin Rushforth <kcr@openjdk.org> Date: 2022-09-16 16:39:23 +0000 URL: https://git.openjdk.org/jfx/commit/5e4552db7389d93829e6ecfc61936ccad75c56c2
16-09-2022

Using the latest master (which includes the fix for JDK-8089009) I can also reproduce the flickering on Windows 10 using the simple "HorizontalConstrainedTableScrollingMin" program supplied by Jeanette in the earlier comment. Andy's PR fixes it. Let's continue the discussion in the PR.
10-09-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jfx/pull/894 Date: 2022-09-09 21:13:25 +0000
09-09-2022

I am going to reopen this ticket, to add the code that suppresses horizontal scroll bar per [~kcr] suggestion.
09-09-2022

So we have a choice: 1. We could fix all the issues in JDK-8293119 2. per [~kcr] suggestion, add a fix to suppress the horizontal scroll bar in case of a CONSTRAINED_RESIZE_POLICY, and later override this fix with JDK-8293119. Me personal preference, of course, is to fix all the issues with the constrained policy in JDK-8293119 Alternative CONSTRAINED_RESIZE_POLICY in openjfx20. There is a chance that JDK-8293119 won't make it into openjfx20, in which case No. 1 is inevitable. Another argument for the second choice is that the virtual flow has a concept of 'breadth scroll bar" instead of "horizontal" and "vertical", which might open a can of worms for the different orientation.
09-09-2022

hmm .. that's strange, I still see it (naturally with current master, but any which includes JDK-8089009 fixed would do, wouldn't it, there was no commit in-between which could have an effect, afaics ;)- first let's try again: - run the minimal example I added in my previous comment - we both are not seeing horizontal scrollbar - decrease window width until blocked by OS: I see hbar visible (I'm on win, so the actual min might vary which might be a reason you don't see it) - that's probably similar to you seeing it in the splitpane - increase to window width beyond the initial width (or start again and increase right from the start): I see the hbar flickering on/off at certain widths (didn't try to find out which widths exactly) If you really don't see the on/off, we are in trouble: no idea what might cause the different behavior in your vs. mine context - we'll probably want to ask others to have a look to help us find the reason
07-09-2022

[~fastegal]: I do not see the flickering (using the latest master branch) - at least on Mac. I cannot make the window narrower than a certain limit (I think the OS prevents us from hiding the maximize/minimize/iconify controls on the native chrome). If we were to place the table into a SplitPane ``` primaryStage.setScene(new Scene(new SplitPane(left, new BorderPane()))); ``` We could see that the HSB appears after the table is shrunk beyond columns' min size (I think the default value is 10 or so) - see the screenshot. BTW, I realized we have many, many issues with the constrained resize policy - see JDK-8292810 and JDK-8293119 Alternative CONSTRAINED_RESIZE_POLICY
06-09-2022

Agreed that it's good to have more options - but first we should be able to fully control the most simple, IMO. Yes, it's a deep dark pit ;) On digging a bit, here it doesn't look related to column's minWidth (though might be in another example) because commenting that setting doesn't make a difference. But also not related to many items/vertical scrollbar visible, as I assumed in my last comment ;) The other thingy that's different is the number of columns: here we have two, the fixed has a single column - being more than one seems to make a different, to see - either remove the second column here: no on/off of hbar - or add another column in the fixed issue: on/off of hbar For convenience, here's one with two columns, no vertical scrollbar having the flickering horizontal scrollbar on changing window width: public class HorizontalConstrainedTableScrollingMin extends Application { @Override public void start(final Stage primaryStage) throws Exception { // left table final TableView<Object> left = new TableView<>(); final TableColumn<Object, String> leftColumn = new TableColumn<>(); left.getColumns().addAll(leftColumn // comment to not see the on/off , new TableColumn<>() ); left.getItems().add(new Object()); left.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); // scene /stage primaryStage.setScene(new Scene(new BorderPane(left))); primaryStage.show(); } public static void main(String[] args) { launch(args); } } So I think we should keep this open - it's not fixed by the other. What do you think?
03-09-2022

The current constrained resize policy has so many issues - see JDK-8292810 (and JDK-8293119)
02-09-2022

I think I know what the problem is. This example sets a minimum width property on a column. It looks like the current implementation honors the minimum column width over the constrained resize policy when table width drops below the sum of minimum widths or so. I think the main issue (flicker) has been solved by JDK-8089009, but other issues remain in the constrained resize policy. I wanted to address them either as part of JDK-8292810, or in a separate improvement ticket. Here is a quick summary: 1. how should TableView behave in the case when a minimum width is set on one or more columns - should it show the horizontal scroll bar, or clip the columns that exceed the width of the table, following JTable behavior? 2. should we support more resize policies by default? JTable offers the following policies via setAutoResizeMode(int): /** Do not adjust column widths automatically; use a horizontal scrollbar instead. */ public static final int AUTO_RESIZE_OFF = 0; /** When a column is adjusted in the UI, adjust the next column the opposite way. */ public static final int AUTO_RESIZE_NEXT_COLUMN = 1; /** During UI adjustment, change subsequent columns to preserve the total width; * this is the default behavior. */ public static final int AUTO_RESIZE_SUBSEQUENT_COLUMNS = 2; /** During all resize operations, apply adjustments to the last column only. */ public static final int AUTO_RESIZE_LAST_COLUMN = 3; /** During all resize operations, proportionately resize all columns. */ public static final int AUTO_RESIZE_ALL_COLUMNS = 4; 3. constrained resize policy should honor minimum, preferred, and maximum column widths, see JDK-8292810 Perhaps we need to ask a wider audience via the mailing list. What do you think?
26-08-2022

hmm .. wondering why we seem to see different results when running the example of this issue? Running against current master: - verified that JDK-8089009 is fixed (horizontal scrollbar no longer flickers on/off) - here the horizontal sb still flickers on/off on resizing the window below a certain width The difference between the examples is that here we have a vertical scrollbar while the fixed has none. What's your experience? If the same, this should be re-opened. If not, any ideas what might explain the different experiences?
26-08-2022

This is a duplicate, fixed by https://bugs.openjdk.org/browse/JDK-8089009
25-08-2022

for fx11, the horizontal scrollbar still appears with constrained resizing, both this example (flickering on/off when resizing the table, both shrinking and enlarging) and the example (even showing initially) of related JDK-8115476, which is marked as resolved/fixed. Regression? or never really fixed? or problem with highDPI?
02-08-2019

Youll probably want to use custom table resize policy by using table.setColumnResizePolicy, if the issue is really bothering you. Unfortunately.
12-09-2014

Any news on this one. This is pretty annoying.
29-08-2014

Scott Palmer is right with the last row behavior. Scrollbar flicker happens only during shrinking, not while enlarging. I think this is one more reason why there should be something like setScrollbarVisible() option, public of course but constrained resize policy would default to false. Correct me if there already is something like that. Just to name the workaround: Use binding instead of resize policy. You know...Colum.widthProperty.bind(Table.widthProperty) (minus all the other columns).Substracting small amount of width from tableWidthProperty should eliminate the flicker. The problem is that you need to count in the size of scrollbar (around 15px). Its even worse because it is there only if needed! The ultimate solution for me was: - enable constrained resize policy - resize fixed columns with setPref, setMin, setMaxSize all together (dont ask me why) + setResizable(false) - dont set any of the pref/min/maxSizez for resizable columns and setResizable(true) - bind resizable columns: prefWidthProperty().bind(table.widthProperty).substract(other rows).substract(15 ) //15=scrollbar what you get is: - Hscrollbar hidden permanently (no hidden last row or anything) - no Hscrollbar flicker - no VScrollbar hiding table data - no empty column when Vscrollbar is hidden - columns all fit table together tested on javaFX8 b105 with single resizable column in the middle of the table
08-09-2013

There are some subtle side-effects of this horizontal scrollbar appearing. For one it obstructs the last row of the table if your are already scrolled to the bottom. When it does do this hitting the down arrow on the vertical scrollbar doesn't scroll the last row into view. The vertical scrollbar thinks it's at the bottom already.
23-01-2013

The horizontal scrollbar will appear even when the table is much wider than the preferred width of the visible columns. Make the table very wide and then slowly shrink it and the horizontal scrollbar will flicker on and off. If you stop when it is on, it stays on. When the scrollbar appears this way the thumb size indicates that the viewport is only showing a small fraction of the table.
23-01-2013

Lowering priority - this is not overly important - the horizontal scrollbar only appears when the tableview width is less than the minimum width of all visible columns. It's not clear what the best course of action is here - perhaps the table should have as its minimum size the sum of the minimum width of all visible columns?
18-07-2011

I rushed to close this. Still observed for controls-scrum-139/2011-07-14_16-18-15 if column's minWidth is set.
15-07-2011

Verified for graphics-scrum-2413/2011-07-14_03-22-53
15-07-2011