On Thu, 3 Apr 2025 20:25:37 GMT, Harshitha Onkar <hon...@openjdk.org> wrote:
>> open sourcing some Swing JTabbedPane tests > > test/jdk/javax/swing/JTabbedPane/bug4273320.java line 57: > >> 55: >> 56: TabbedPaneUI ui = tabs.getUI(); >> 57: Rectangle origSize = ui.getTabBounds(tabs, 0); > > On EDT ? I don't think it is needed here because the UI is stable and so access should be safe. > 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. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/24370#discussion_r2027726025 PR Review Comment: https://git.openjdk.org/jdk/pull/24370#discussion_r2027724096