🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #1515

newbie: graphics questions

#1515
From: Markus Stehle
Date: Wed, 21 Nov 2001 09:33
26 lines
2101 bytes
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
Technical Details
Message-ID: <3bfb7529_1@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 1089d0,f175a4535853b414,start
X-Google-Attributes: gid1089d0,public
X-Google-ArrivalTime: 2001-11-21 01:38:12 PST
From: "Markus Stehle" <markus.stehle@web.de>
Newsgroups: borland.public.jbuilder.java.api
Subject: newbie: graphics questions
Date: Wed, 21 Nov 2001 10:33:56 +0100
Lines: 29
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: <3bfb7529_1@dnews>
X-Trace: dnews 1006335273 195.143.49.100 (21 Nov 2001 01:34:33 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews