Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Image loading

Reply
Thread Tools

Image loading

 
 
s.magnien@gmail.com
Guest
Posts: n/a
 
      06-05-2005
Hi all.
What I'd like would be two classes:

public class Main extends java.applet.Applet
{
Room current_room;
.....
}

and

public class Room extends java.applet.Applet
{
//loads images
public void Paint(Graphics g)
{
g.drawImage(//loaded images...);
}
}

I have this working _provided_ the images are loaded through Room's
constructor Room, something like

Room(Images[]), when Main does

current_room=new Room(Images[]); in its init method.

I would like Room to load its images on its own. I tried loading them
in Room(), in init(), in Paint(), devising a custom loading function,
but nothing works. I'm fairly sure the images are loaded, as catch
doesn't return any problems, but they won't draw _except_ if the images
are loaded through Room()'s constructor.

Is this construct wrong? (if so, sorry, I am a two-day old java "coder"
) If it ain't, what am I missing?

Thank you all!

 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      06-05-2005
On 5 Jun 2005 15:02:41 -0700, wrote:

> (if so, sorry, I am a two-day old java "coder"
> ) If it ain't, what am I missing?


Post an SSCCE[1] (with URL) to c.l.j.help[2] and I will provide assistance.
But please first read the info on applets[3], painting[4] and
image loading[5] and tracking[6] first.

[1] <http://www.physci.org/codes/sscce.jsp>
[2] <http://www.physci.org/codes/javafaq.jsp#cljh>
[3] <http://java.sun.com/docs/books/tutorial/applet/index.html>
[4] <http://java.sun.com/docs/books/tutorial/uiswing/14painting/index.html>
[5] <http://java.sun.com/docs/books/tutorial/2d/overview/images.html>
[6] <http://java.sun.com/j2se/1.5.0/docs/api/java/awt/MediaTracker.html>

( shrugs.. I have dealt with a few too many
'2 day old applet programmers' recently

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
 
Reply With Quote
 
 
 
 
s.magnien@gmail.com
Guest
Posts: n/a
 
      06-06-2005
Thank you; I wasn't aware of c.l.j.h - I will post there a short
compilable code.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
order of iframe loading with document loading ofir Javascript 0 12-03-2007 12:06 PM
loading image -> detect when image is done loading edfialk Javascript 0 05-10-2007 07:28 PM
[OT] Is loading the second Java application faster than loading the first? David Segall Java 2 01-02-2007 04:41 PM
Image loading using javascript. Handling timeouts and parrallel loading under IE zborisau@gmail.com Javascript 4 08-28-2005 02:02 PM
wx.Image: Couldn't add an image to the image list. Laszlo Zsolt Nagy Python 1 01-26-2005 09:55 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57