Article View: borland.public.jbuilder.java.api
Article #1529Re: newbie: graphics questions
From: Markus Stehle
Date: Thu, 22 Nov 2001 09:29
Date: Thu, 22 Nov 2001 09:29
92 lines
4182 bytes
4182 bytes
Hi Avi! Thanks alot for your reply. Well, you�re right, maybe I should start up with an easier project :-) I have experience in C++ as well as in some other languages so Java should not be completly new to me. I played around by myself and I could figure out some things that helped me progressing to my goal. But there are still some unanswered questions :-) I�ll have a look at the clock sample and the website you gave me ... so I hope I�ll find some useful hints. Regards Markus "Avi Abrami" <aabrami@intersystemsww.com> wrote in message news:3BFB981E.6722C34D@intersystemsww.com... > Markus Stehle wrote: > > > Hi all! > > > > I�m new to Java development. I�m trying to write a little applet with a bar > > chart where the user can control each bar (currenlty 3 bars, the user can > > use his mouse to rise or lower each bar seperatly; rising or lowering one > > bar influences the other ones). Each bar is painted in a separate Canvas. To > > display the bars I use the fillRect() and clearRect() method of the Graphics > > object which is obtained from the different Canvases. My first problem is > > about applet initialzitaion: when the applet starts, three unfilled > > rectangles should be painted so that user can see something in his browser - > > not only a gray apllet box. When I call the myCanvas.getGraphics() and > > myGraphics.fillRect() method in my jbinit() method, I always get null > > pointer exceptions. I assume the objects are not already created while the > > constructor method is executed so I ca�n't access them. So where else can I > > call my methods? Is there something like an "applet loaded" event which I > > can catch and make my drawings there? > > > > My second question is about background images. How can I lay an image behind > > my bars? When I call the drawImage() method of the Graphics object and > > afterwards the drawRect() method, the image is positioned before the > > rectangle instead of behind. > > > > Thanks & Regards > > > > Markus > > Hi Markus, > First, I would like to make two observations: > > 1. If you are new to java, you seem to be starting off > with an awfully complex project! > 2. From personal experience, java newcomers should > really stay away from the JBuilder wizards until they > have mastered the basics using first principals -- in > other words, best to do everything yourself, without > the help of the wizard. > > Now to your question. Unfortunately, I can't really > give you an answer, but I see this is the second time > you're asking the same question (and you think > you'll get better luck if you try a different newsgroup) > so I thought I'd suggest something (a bit simpler than > what you're trying) with the hope that it will help > progress you toward your goal. > > Anyway, the JDK comes with a sample applet > that displays an analog clock whose hands move > in real time (including a seconds hand, I think). > The source code is also available in the JDK, > so perhaps it can help you understand the use > of the Graphics class. > > Also, are you familiar with JARS > (http://www.jars.com)? They may have applets > similar to what you are trying to do, which may > help you, also. > > Good Luck, > Avi. > > >
Technical Details
Message-ID:
<3bfcc59a$1_1@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!hub.org!hub.org!PeerFeed.KWeb.on.ca!dnewsReferences:
<3bfb7529_1@dnews> <3BFB981E.6722C34D@intersystemsww.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 1089d0,f175a4535853b414 X-Google-Attributes: gid1089d0,public X-Google-ArrivalTime: 2001-11-22 01:34:41 PST From: "Markus Stehle" <markus.stehle@web.de> Newsgroups: borland.public.jbuilder.java.api References: <3bfb7529_1@dnews> <3BFB981E.6722C34D@intersystemsww.com> Subject: Re: newbie: graphics questions Date: Thu, 22 Nov 2001 10:29:30 +0100 Lines: 94 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: 195.143.49.100 Message-ID: <3bfcc59a$1_1@dnews> X-Trace: dnews 1006421402 195.143.49.100 (22 Nov 2001 01:30:02 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!hub.org!hub.org!PeerFeed.KWeb.on.ca!dnews