On Tue, 26 Jul 2022 22:59:03 GMT, Sai Pradeep Dandem <[email protected]> wrote:

>>> I am not sure about setting TableView.CONSTRAINED_RESIZE_POLICY means to 
>>> always hide the horizontal scroll bar. The most common use case with the 
>>> CONSTRAINED_RESIZE_POLICY, is to auto stretch the columns if there is 
>>> enough space, and set to the minimum widths and show horizontal scroll bar 
>>> if there is not enough space. I included an example in this stackoverflow 
>>> [question](https://stackoverflow.com/questions/73060277/horizontal-scrollbar-is-visible-in-tableview-with-constrained-resize-policy)
>>>  and the gif show-casing the requirement (2nd gif). And the current code 
>>> already handles this very well.
>> 
>> Quite the opposite.  As an app developer, I've used unrestrained policy (in 
>> swing) exactly once, all other cases used fit-to-width.
>> 
>> Even if you look at stackoverflow and even 
>> [JDK-8089280](https://bugs.openjdk.org/browse/JDK-8089280) it is clear that 
>> the app developers do not want to see the horizontal scroll bar with the 
>> constrained policy set, ever.  This was one of the pain points with javafx 
>> coming from swing.  
>> 
>> In swing, JTable offers a rich set of possibilities:
>> 
>> `    /** 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;`
>> 
>> In javafx, behavior of TableView.CONSTRAINED_RESIZE_POLICY is, permit me to 
>> say, simply incorrect.  The scope of this discussion may go beyond the scope 
>> of this PR, but the fact that we have a number of JDK bugs logged against it 
>> is an indication.
>
> @andy-goryachev-oracle Thanks for providing the info about constrained resize 
> policy in Swing. Unfornately I didn't get a chance to work with Swing, so I 
> am not fully aware of this functionality that existed in Swing. At this stage 
> in JavaFX,the need with scroll bar visibility comes into picture when working 
> with resizable windows. May be as mentioned in one of the comments in 
> [JDK-8089280](https://bugs.openjdk.org/browse/JDK-8089280), when constrained 
> resize policy is set, it needs to set/override the minWidth of the table view 
> to total minWidths of all columns. And as you said, this might be beyond the 
> scope of this PR.

@SaiPradeepDandem This is now ready to be integrated. The next step is for you 
to issue the `/integrate` command, and then Ajit or I will sponsor it.

-------------

PR: https://git.openjdk.org/jfx/pull/848

Reply via email to