The moose likes Swing / AWT / SWT and the fly likes NullPointerException thrown by method drawImage() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "NullPointerException thrown by method drawImage()" Watch "NullPointerException thrown by method drawImage()" New topic

NullPointerException thrown by method drawImage()

Roy Nordstrom

Joined: Jul 05, 2012
Posts: 1

Hi, I am getting a NullPointerException when I execute the line

done = drawImage( img, 0, 0, null );

Please see the full list of exceptions pasted at the end of this post.

Does anyone have any idea how I can address this problem ?



Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at REN.TheFrame.Load_ImageActionPerformed(
at REN.TheFrame.access$000(
at REN.TheFrame$1.actionPerformed(
at javax.swing.AbstractButton.fireActionPerformed(
at javax.swing.AbstractButton$Handler.actionPerformed(
at javax.swing.DefaultButtonModel.fireActionPerformed(
at javax.swing.DefaultButtonModel.setPressed(
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(
at java.awt.Component.processMouseEvent(
at javax.swing.JComponent.processMouseEvent(
at java.awt.Component.processEvent(
at java.awt.Container.processEvent(
at java.awt.Component.dispatchEventImpl(
at java.awt.Container.dispatchEventImpl(
at java.awt.Component.dispatchEvent(
at java.awt.LightweightDispatcher.retargetMouseEvent(
at java.awt.LightweightDispatcher.processMouseEvent(
at java.awt.LightweightDispatcher.dispatchEvent(
at java.awt.Container.dispatchEventImpl(
at java.awt.Window.dispatchEventImpl(
at java.awt.Component.dispatchEvent(
at java.awt.EventQueue.dispatchEventImpl(
at java.awt.EventQueue.access$000(
at java.awt.EventQueue$
at java.awt.EventQueue$
at Method)
at java.awt.EventQueue$
at java.awt.EventQueue$
at Method)
at java.awt.EventQueue.dispatchEvent(
at java.awt.EventDispatchThread.pumpOneEventForFilters(
at java.awt.EventDispatchThread.pumpEventsForFilter(
at java.awt.EventDispatchThread.pumpEventsForHierarchy(
at java.awt.EventDispatchThread.pumpEvents(
at java.awt.EventDispatchThread.pumpEvents(
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
possibly duplicate declarations for 'img'?

(posting your code would help)
I agree. Here's the link:
subject: NullPointerException thrown by method drawImage()
It's not a secret anymore!