0

i have this wierd exception wheere it's stack trace IS NOT HELPING OR SHOWING WHERE IT IS FROM !!!!!!!!! .

I'v searched about it and the usefull resault with someone who did have the same glitch when using a modal JDialog instances and disposing it with KeyListner while the frame owner alwaysOnTop proprety is set to false .

But in my case i havn't use any dialogs at all!! here is the exception stack trace :

Exception in thread "AWT-EventQueue-0" java.awt.IllegalComponentStateException: component must be showing on the screen to determine its location at java.awt.Component.getLocationOnScreen_NoTreeLock(Component.java:2062) at java.awt.Component.getLocationOnScreen(Component.java:2036) at javax.swing.text.JTextComponent$InputMethodRequestsHandler.getTextLocation(JTextComponent.java:4643) at sun.awt.im.InputMethodContext.getTextLocation(InputMethodContext.java:278) at sun.awt.windows.WInputMethod$1.run(WInputMethod.java:588) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90) at java.awt.EventQueue$4.run(EventQueue.java:731) at java.awt.EventQueue$4.run(EventQueue.java:729) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) 

I haven't used this app for a while and i can confirm that no one did mess with the code ,earlier i was devoloping the app in a linux enviroment it didn't throw that exception , but after changing my laptop and the enviroment to windows somehow this is happenning . I need to deliver my app soon and this exception have a strange thing that it's not thrown every time i open my app ! and i couldn't face any pattern to notice when it wil be thrown or what specific action that would do that . what am asing is if any one did face off a strange case like this what is it usually from ?? and thanks in advance .

Edit
Found the solution !I just found it at bugzilla it seems to be some sort of bug when is extending JRootPane without implemeting RootPaneContainer in windows in Runtime: Java(TM) SE Runtime Environment 1.8.0_141-b15 with some gpu and methods related stuff i couldn't understand and if also used modal JDialogs without the owner always on top when using the default rootpane button of the dialogs to exit .

12
  • You are trying to get location of text component? Commented Feb 24, 2019 at 2:31
  • nope, nothing about trying to get a location of any component Commented Feb 24, 2019 at 2:32
  • 2
    it's not thrown every time i open my app - Swing components should be created and updated on the Event Dispatch Thread (EDT), otherwise you can have random results. Read the Swing tutorial on Concurrency for more information and examples of the proper way to create the GUI. Commented Feb 24, 2019 at 2:32
  • Is this complete stack trace? Where is your code? Commented Feb 24, 2019 at 2:36
  • 1
    We don't have all night to make wild guesses. Start to do some basic debugging. Remove blocks of code until it starts working. Then you know what you just removed and have isolated the problem. Then you solve the problem. Or you have useful information to add to the question. You have been given the main cause of random problems. Post your minimal reproducible example that demonstrates the problem. Commented Feb 24, 2019 at 2:45

1 Answer 1

1

I used to get regular Swing Exceptions without a traceable stack trace. It was because I was violating the rules regarding concurrency in Swing. This SO answer elaborates: SwingWorker ProgressBar. Basically, make sure all of your Swing code is being called on the Event Dispatch Thread.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.