Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 12th, 2005, 11:12 AM   #1
Dark Flare Knight
Hobbyist Programmer
 
Join Date: Mar 2005
Location: Canada
Posts: 113
Rep Power: 4 Dark Flare Knight is on a distinguished road
multiple images

how can i display multiple images in a java application?

right now, this is what i'm doing:

import java.awt.*;
import hsa.Console;
import java.awt.image.*;
public class img1 implements ImageObserver
{
    static Console c = new Console ();
    public Image Pic;
    public static void main (String[] args)
    {
        new img1 ();
    }


    public img1 ()
    {
        Toolkit tk = Toolkit.getDefaultToolkit ();
        Pic = tk.getImage ("1.jpg");
        tk.prepareImage (Pic, -1, -1, this);
    }


    public boolean imageUpdate (Image img, int infoflags, int x, int y, int width, int height)
    {
        if (infoflags == 32)
        {
            c.drawImage (Pic, 16, 16, null);
        }
        return true;
    }
}

Last edited by Dark Flare Knight; Jun 12th, 2005 at 2:27 PM.
Dark Flare Knight is offline   Reply With Quote
Old Jun 13th, 2005, 9:47 AM   #2
Pilgrim
Newbie
 
Join Date: Jun 2005
Posts: 11
Rep Power: 0 Pilgrim is on a distinguished road
Ok, I got 3 compiler errors when I compiled your code.

C:\Documents and Settings\student\Desktop\img1.java:2: package hsa does not exist
import hsa.Console;
           ^
C:\Documents and Settings\student\Desktop\img1.java:6: cannot resolve symbol
symbol  : class Console 
location: class img1
    static Console c = new Console ();
           ^
C:\Documents and Settings\student\Desktop\img1.java:6: cannot resolve symbol
symbol  : class Console 
location: class img1
    static Console c = new Console ();

I've never heard of hsa.Console. What's hsa?
Pilgrim is offline   Reply With Quote
Old Jun 13th, 2005, 10:01 AM   #3
Dark Flare Knight
Hobbyist Programmer
 
Join Date: Mar 2005
Location: Canada
Posts: 113
Rep Power: 4 Dark Flare Knight is on a distinguished road
hsa.Console.....we use this in school and i got it from the software my teacher gave me.

It's used to create a Console identifier and instead of System.out., we use the identifier.
Dark Flare Knight is offline   Reply With Quote
Old Jun 13th, 2005, 10:59 AM   #4
Berto
Programming Guru
 
Join Date: Aug 2004
Posts: 1,022
Rep Power: 6 Berto is on a distinguished road
Send a message via AIM to Berto Send a message via MSN to Berto
unfortunatly it does provide a problem with debugging your code if we dont have the hsa console thingy :/
__________________
"Put your hand on a hot stove for a minute, and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute. THAT'S relativity."

- Albert Einstein
Berto is offline   Reply With Quote
Old Jun 13th, 2005, 3:27 PM   #5
Dark Flare Knight
Hobbyist Programmer
 
Join Date: Mar 2005
Location: Canada
Posts: 113
Rep Power: 4 Dark Flare Knight is on a distinguished road
should i post it here? i mean the file.

EDIT

The only thing that's using the hsa.Console is the c.drawString and the static Console c = new Console (); and except these two, the rest are from java.awt.*; and java.awt.image.*; i think.

Last edited by Dark Flare Knight; Jun 13th, 2005 at 8:15 PM.
Dark Flare Knight is offline   Reply With Quote
Old Jun 14th, 2005, 1:37 PM   #6
Pilgrim
Newbie
 
Join Date: Jun 2005
Posts: 11
Rep Power: 0 Pilgrim is on a distinguished road
The thing is, even though only a couple of statements may be using hsa.Console, I can't compile your code without it. If I can't compile your code, I can't run your program. I don't know what to tell you if I don't know what it already does.

So I'd like to see hsa.Console so I can try to help you better.
Pilgrim is offline   Reply With Quote
Old Jun 14th, 2005, 5:34 PM   #7
Dark Flare Knight
Hobbyist Programmer
 
Join Date: Mar 2005
Location: Canada
Posts: 113
Rep Power: 4 Dark Flare Knight is on a distinguished road
But do you know how to display multiple images in a java application?
Dark Flare Knight is offline   Reply With Quote
Old Jun 14th, 2005, 11:43 PM   #8
xavier
Professional Programmer
 
xavier's Avatar
 
Join Date: Oct 2004
Location: .ro
Posts: 406
Rep Power: 5 xavier is on a distinguished road
Send a message via Yahoo to xavier
Dude, have u ever heard of GOOGLE ? this is the first link that apears :
http://forum.java.sun.com/thread.jsp...sageID=3590564
__________________
Don't take life too seriously, it's not permanent !
xavier is offline   Reply With Quote
Old Jun 15th, 2005, 8:19 AM   #9
Dark Flare Knight
Hobbyist Programmer
 
Join Date: Mar 2005
Location: Canada
Posts: 113
Rep Power: 4 Dark Flare Knight is on a distinguished road
Quote:
Originally Posted by xavier
Dude, have u ever heard of GOOGLE ? this is the first link that apears :
http://forum.java.sun.com/thread.jsp...sageID=3590564
i don't understand any of the code.
Dark Flare Knight is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:04 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC