On Thu, 3 Apr 2025 20:51:03 GMT, Phil Race <p...@openjdk.org> wrote:

>> test/jdk/javax/swing/JTabbedPane/bug4287268.java line 59:
>> 
>>> 57:             Point point = jtp.getLocationOnScreen();
>>> 58:             int width = jtp.getWidth();
>>> 59:             int height = jtp.getHeight();
>> 
>> Might be good to wrap it in EDT. 
>> 
>> It was the following `getComponentBounds()` method that @azvegint suggested 
>> we move to Util (since we use it across multiple tests), but it does create 
>> a dependency on Util class.
>> 
>> 
>> Rectangle jtpLoc = Util.invokeOnEDT(() ->
>>                                         getComponentBounds(jtp));
>> 
>> private static Rectangle getComponentBounds(Component component) {
>>         Point locationOnScreen = component.getLocationOnScreen();
>>         Dimension size = component.getSize();
>>         return new Rectangle(locationOnScreen, size);
>> }
>
> As I said when it was  discussed, I like to avoid dependencies just for the 
> sake of a few lines of code.

Yes, I agree it does create extra dependency if Util is used.
Without using Util, is it good to obtain JTabbedPane's location and size on EDT 
for stability?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24370#discussion_r2027769090

Reply via email to