Article View: borland.public.jbuilder.java.language
Article #7714Some questions about graphic....
From: Erik �kerlund
Date: Tue, 29 May 2001 21:53
Date: Tue, 29 May 2001 21:53
38 lines
2652 bytes
2652 bytes
Hi, I have a few questions concerning drawing images, and graphics with
Java.
1. When I draw the graphics they all get erased as soon as I move the window
or if I switch to another window and move it over the window where I have
drawn everything. How can I prevent this?
2. If I for some reason wants to clear the surface where I draw all the
graphics, how do I do then?
3. If I want to know an image's actual size....how do I do then?
4. When I first press the button, the image doesn't show up...only the line.
Though it does the 2nd or the 3rd time I press it...why is this?
This is what the code looks like (occurs when you press a button):
//-------------------
Image bild=getToolkit().getImage("C:\Mina dokument\Mina bilder\anna.jpg");
Color f�rg = new Color(150,0,0);
Graphics g = getGraphics();
g.setColor(f�rg);
g.drawImage(bild,0,30, 200,200,this);
g.drawLine(0,30,100,100);
//----------------------
Please help...I'm a real newbie when it comes to graphics in Java...
--
Mvh, Erik
E-mail: ruler_of_earth@cheerful.com
alt. meracl@hotmail.com
Homepage: http://come.to/meracl or http://surf.to/partybilder
Technical Details
Message-ID:
<991173326.84035@news2.cybercity.dk>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!area.cu.mi.it!ams.uu.net!news.cybercity.dk!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 111d45,f297ca67ae809d47,start X-Google-Attributes: gid111d45,public X-Google-Thread: 10a146,f297ca67ae809d47,start X-Google-Attributes: gid10a146,public X-Google-Thread: f74b3,f297ca67ae809d47,start X-Google-Attributes: gidf74b3,public X-Google-Thread: f82aa,f297ca67ae809d47,start X-Google-Attributes: gidf82aa,public X-Google-ArrivalTime: 2001-05-29 14:54:22 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!area.cu.mi.it!ams.uu.net!news.cybercity.dk!not-for-mail From: "Erik �kerlund" <ruler_of_earth@cheerful.com> Newsgroups: borland.public.jbuilder.java.language,borland.public.jbuilder.java.swing,comp.lang.java.programmer,it.comp.java Subject: Some questions about graphic.... Date: Tue, 29 May 2001 23:53:49 +0200 Organization: Cybecity Internet Aps, Denmark Lines: 40 Message-ID: <991173326.84035@news2.cybercity.dk> NNTP-Posting-Host: news2.cybercity.dk X-Trace: news.cybercity.dk 991173255 55967 212.242.96.132 (29 May 2001 21:54:15 GMT) X-Complaints-To: abuse@cybercity.dk NNTP-Posting-Date: Tue, 29 May 2001 21:54:15 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Cache-Post-Path: news2.cybercity.dk!unknown@port111.cvx1-sto.ppp.netlink.se X-Cache: nntpcache 2.4.0b1 (see http://www.nntpcache.org/)