Results 1 to 2 of 2
- 07-22-2011, 05:51 AM #1
Member
- Join Date
- Jul 2011
- Posts
- 2
- Rep Power
- 0
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
Okay, so this may be a newbie question (because in reality, that's what I am), but I am receiving this error:
When my code (below) throws an IllegalAccessException (It begins to display the JOptionPane, the pane freezes, and never renders. Upon trying to close the window, I receive the above error.Java Code:Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at javax.swing.SwingUtilities.computeIntersection(Unknown Source) at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source) at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$000(Unknown Source) at java.awt.EventQueue$1.run(Unknown Source) at java.awt.EventQueue$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)
I've looked it up quite a bit, and haven't found anything overly useful. From what I can tell, the error is actually occurring outside my code (seeing as it isn't referenced in the error), I just can't seem to figure out how to solve it. Any help is appreciated. Thanks!Java Code:public Color renderStringToColor(String colorString) { if(colorString == null){ throw new IllegalArgumentException("Color must be designated."); } Color colorToReturn; Field colorField; try{ colorField = Color.class.getField(colorString.toUpperCase().trim()); colorToReturn = (Color) colorField.get(null); } catch(NoSuchFieldException nsfe){ JOptionPane.showMessageDialog(null, "The declared color is not valid; defaulting to black.", "No Such Field Exception", JOptionPane.ERROR_MESSAGE); return Color.BLACK; } catch(IllegalAccessException iae){ JOptionPane.showMessageDialog(null, "The current color is unavailable to be used; defaulting to black.", "Illegal Access Exception", JOptionPane.ERROR_MESSAGE); return Color.BLACK; } catch(SecurityException se){ JOptionPane.showMessageDialog(null, "Access to declared color denied; defaulting to black.", "Security Exception", JOptionPane.ERROR_MESSAGE); return Color.BLACK; } return colorToReturn; }
- 07-22-2011, 06:27 AM #2
Member
- Join Date
- Jul 2011
- Posts
- 2
- Rep Power
- 0
Just Kidding. I just solved the problem myself.
I didn't realize that static method calls to JOptionPane were still modal and blocked the EDT.
Interestingly enough, wrapping the call to JOptionPane within invokeLater() solved the problem.
Thanks to anyone who took the time to read the above problem. I appreciate the effort.
Similar Threads
-
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException with jcombox :S
By talon in forum AWT / SwingReplies: 1Last Post: 12-13-2010, 03:19 PM -
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
By Cluster Storm in forum AWT / SwingReplies: 6Last Post: 06-06-2010, 09:02 PM -
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
By kiz106 in forum NetBeansReplies: 0Last Post: 05-28-2010, 02:47 PM -
ERROR: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
By PFworth in forum New To JavaReplies: 3Last Post: 04-30-2010, 07:44 PM -
help debugging: exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
By freqrush in forum AWT / SwingReplies: 5Last Post: 08-26-2009, 11:37 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks