For moving tabs in JTabbedPane I use code like this:
tabbedPane.remove(jfxPanel);
tabbedPane.insertTab(label, null, jfxPanel, tooltip, toIndex);
And rarely get following exception:
Exception in runnable
java.awt.IllegalComponentStateException: component must be showing on the screen to determine its location
at java.awt.Component.getLocationOnScreen_NoTreeLock(Component.java:2043)
at java.awt.Component.getLocationOnScreen(Component.java:2017)
at javafx.embed.swing.JFXPanel.sendMoveEventToFX(JFXPanel.java:394)
at javafx.embed.swing.JFXPanel.access$600(JFXPanel.java:94)
at javafx.embed.swing.JFXPanel$HostContainer.setEmbeddedStage(JFXPanel.java:585)
at com.sun.javafx.tk.quantum.EmbeddedStage.<init>(EmbeddedStage.java:31)
at com.sun.javafx.tk.quantum.QuantumToolkit.createTKEmbeddedStage(QuantumToolkit.java:460)
at com.sun.javafx.stage.EmbeddedWindow.impl_visibleChanging(EmbeddedWindow.java:45)
at javafx.stage.Window$13.invalidated(Window.java:660)
at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:88)
at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:122)
at javafx.stage.Window.setShowing(Window.java:744)
at javafx.stage.Window.show(Window.java:759)
at com.sun.javafx.stage.EmbeddedWindow.show(EmbeddedWindow.java:36)
at javafx.embed.swing.JFXPanel$5.run(JFXPanel.java:545)
at com.sun.javafx.application.PlatformImpl$3.run(PlatformImpl.java:108)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
at com.sun.glass.ui.win.WinApplication$2$1.run(WinApplication.java:62)
at java.lang.Thread.run(Thread.java:722)
To reproduce the bug launch attached file and click on button.
tabbedPane.remove(jfxPanel);
tabbedPane.insertTab(label, null, jfxPanel, tooltip, toIndex);
And rarely get following exception:
Exception in runnable
java.awt.IllegalComponentStateException: component must be showing on the screen to determine its location
at java.awt.Component.getLocationOnScreen_NoTreeLock(Component.java:2043)
at java.awt.Component.getLocationOnScreen(Component.java:2017)
at javafx.embed.swing.JFXPanel.sendMoveEventToFX(JFXPanel.java:394)
at javafx.embed.swing.JFXPanel.access$600(JFXPanel.java:94)
at javafx.embed.swing.JFXPanel$HostContainer.setEmbeddedStage(JFXPanel.java:585)
at com.sun.javafx.tk.quantum.EmbeddedStage.<init>(EmbeddedStage.java:31)
at com.sun.javafx.tk.quantum.QuantumToolkit.createTKEmbeddedStage(QuantumToolkit.java:460)
at com.sun.javafx.stage.EmbeddedWindow.impl_visibleChanging(EmbeddedWindow.java:45)
at javafx.stage.Window$13.invalidated(Window.java:660)
at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:88)
at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:122)
at javafx.stage.Window.setShowing(Window.java:744)
at javafx.stage.Window.show(Window.java:759)
at com.sun.javafx.stage.EmbeddedWindow.show(EmbeddedWindow.java:36)
at javafx.embed.swing.JFXPanel$5.run(JFXPanel.java:545)
at com.sun.javafx.application.PlatformImpl$3.run(PlatformImpl.java:108)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
at com.sun.glass.ui.win.WinApplication$2$1.run(WinApplication.java:62)
at java.lang.Thread.run(Thread.java:722)
To reproduce the bug launch attached file and click on button.