Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 images in hsa console?
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
cutecotton




PostPosted: Wed Jan 07, 2004 5:39 pm   Post subject: images in hsa console?

hey everyone Smile

i'm using HSA Console for my programming project, and i'm wondering..is it possible to use iamges in it? by images, i mean outside graphics (pictures and wahtever)? I konw it can be done with applets, but the hsa console *does* have a method called "drawImage" i just dont 'know how to use it..

if anyone can shed some light on this, that'd be great Smile thanks a bunch
Sponsor
Sponsor
Sponsor
sponsor
rizzix




PostPosted: Sat Jan 10, 2004 11:07 pm   Post subject: (No subject)

wht's an HSA console really? i've never heard of it.

i could help if u don't mind showing me the api documention (Java Docs)
yuethomas




PostPosted: Sun Jan 11, 2004 12:40 pm   Post subject: (No subject)

HSA console is something that Holt Software (maker of Ready to Program) made to "simplify" Java programming. In my opinion it does more harm than good.

I think HSA is text-only; so you can't import graphics. If you don't need to manipulate your image, I'd use a JLabel:

code:
JLabel lblImage = new JLabel (new ImageIcon (file-path));
Tony




PostPosted: Sun Jan 11, 2004 5:22 pm   Post subject: (No subject)

hahaha Laughing HoltSoft Laughing simplify Laughing sorry, thats too funny Laughing

First of all - Java is a very simple language to begin with. Then if you use a desent IDE (I prefer eclipse) then it's even easier Laughing
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
cutecotton




PostPosted: Sun Jan 11, 2004 7:18 pm   Post subject: (No subject)

JLabel lblImage = new JLabel (new ImageIcon (file-path));

about that ocding..i tried to use it in my HSA console program, and it told JLabel type not foiund or something. Are there other things that you have to do to make it wrok?

I don't need to manipulate the image or anything. And i'm not sure if HSA is good or not. I was goign to trya nd use applets but for some reason i can't figure it out Embarassed i know, you guys probably find it easy, but all i learend through teh entire java class was stuff like "System.out.println ("hello");"

thankie Smile
Tony




PostPosted: Sun Jan 11, 2004 8:25 pm   Post subject: (No subject)

to use Java's GUI you need to declear a form first. I dont remember the code though Confused

and I sujest checking out some other IDEs to program in. Holtsoft is a joke Laughing Rizzix has put together a nice collection of links to various IDEs with his opinion about each - check some out (i prefer Eclipse)
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
rizzix




PostPosted: Mon Jan 12, 2004 12:26 am   Post subject: (No subject)

i agree with tony, Eclipse is really good. You should try it out. Its free and has far too many features, just fun to play with. And yes, i do all my projects on eclipse. It looks pretty cool too. (SWT GUI framework incase ur wondering)
cutecotton




PostPosted: Mon Jan 12, 2004 7:41 am   Post subject: (No subject)

i..have no clue what you guys are talking about Embarassed but i can't switch from HSA now becuase i'm too far in my project to go and switch..the project's due in four days Embarassed but where can i find the elicipse? i wnat to check it out anyways.
Tony




PostPosted: Mon Jan 12, 2004 9:23 am   Post subject: (No subject)

rizzix's post if found here and the direct link to eclipse is here. When downloading, go for 3.0 Stream Stable Builds not latest release
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
communismisntdead




PostPosted: Fri Apr 30, 2004 11:21 am   Post subject: (No subject)

Ive almost figured it out. As far as I know, this is some of what you need:

Component frank = new Component ().createImage (100, 100);
Canvas canvas = new Canvas ();
canvas.setSize (400, 400);
Image van;
Frame hank = new Frame ("Luke is cool");
hank.setLayout (new BorderLayout ());
hank.setVisible (true);
hank.setSize (500, 500);
hank.add ("Center", canvas);

ImageObserver watch = null;
van = Component.createImage (100, 100);

//Toolkit.getDefaultToolkit ().getImage ("iceCreamVan.jpg");

Graphics draw = van.getGraphics ();

hank.prepareImage (van, watch);
draw.drawImage (van, 0, 0, watch);

delay (2000000000);
hank.dispose ();

So basically it has to do with toolkits, frames, imageobservers, and components.

No, it doesn't run. So fix it and show me how. (luke.reimer@sympatico.ca)
Dan




PostPosted: Fri Apr 30, 2004 12:21 pm   Post subject: (No subject)

Just whondering, dose holth softs java have swing GUI suport in it? it whould seem very like holth to take out every API but the ones they mod.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
communismisntdead




PostPosted: Fri Apr 30, 2004 1:28 pm   Post subject: (No subject)

I'm not completely sure... GUI in the Paint section of an Application is supported... Graphics package classes are around there somewhere too. Ask holt (holtsoft.com)

Okay I figured out the image thing, heres the code:
------------------------------------------------------


// A canvas is created and set with a size of 400 by 400.
Canvas canvas = new Canvas ();
canvas.setSize (500, 500);

Image van; // The image variable that will hold the picture.

// A new frame is created (basically a new window).
Frame imageWindow = new Frame ("Frame title goes here");

imageWindow.setLayout (new BorderLayout ()); // Layout is selected
imageWindow.setVisible (true); // It is displayed
imageWindow.setSize (500, 500); // Size is set to 500 by 500
imageWindow.add ("Center", canvas); // the canvas is added

ImageObserver watch = null; // A null ImageObserver is created.

// Van gets the image to be shown (in this case, iceCreamVan.jpg).
// as far as I know, jpg, jpeg, and gif are all that can be used.
van = Toolkit.getDefaultToolkit ().getImage ("iceCreamVan.jpg");

// A new instance of the graphics class is created and
// applied to our image.
Graphics draw = van.getGraphics ();

// So far the only way I can get the image to be shown is to place
// it in an endless loop...
while (true)
{
imageWindow.prepareImage (van, watch); // The image is prepared
draw.drawImage (van, 0, 0, watch); // The image is drawn.
}

// a delay of 20000000000 is executed.
// you'll have to make your own delay method. Just do
// Math.PI * Math.PI over and over again in a for loop.

delay (2000000000);
// after the delay, the window closes.
imageWindow.dispose ();

// Questions? Email luke.reimer@sympatico.ca

--------------------------------------

By the way, this can all be done in your main app. That is, in an application, not an applet. And, in a normal method, not in a class (although that could and probably should be done).

Luke
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 12 Posts ]
Jump to:   


Style:  
Search: