Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2007

Tip: Looking for answers? Try searching our database.

Error at drawing on the Canvas

Thread view: 
lrantisi - 01 Apr 2007 02:31 GMT
I have the following code:

Graphics canvasGraphics
canvasGraphics.drawLine(x, y, 200, 200);

which works fine on a machine. But on another machine, I receive the
following error messages.

===============
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at pan$1.mouseClicked(pan.java:82)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(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)
+++++======================

Why do I get this
Andrew Thompson - 01 Apr 2007 07:48 GMT
> I have the following code:
>
> Graphics canvasGraphics
> canvasGraphics.drawLine(x, y, 200, 200);

That code does not compile.

> which works fine on a machine.

No it wouldn't.  It would not even compile.
Please stop wasting your time, and our bandwdidth,
posting snippets of code that do not express the
problem.

I recommend you prepare an SSCCE that shows the
same behaviour, and post that instead.
<http://www.physci.org/codes/sscce.html>

Andrew T.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.