
-----------------------------------
ify
Thu May 06, 2004 9:02 pm

easy graphics in java question
-----------------------------------
:D  :)  :roll:  :twisted:  :idea:  :?:  :?::lol:  :oops:  :P  :x  :cry:  :wink:  :roll:  :idea:  :twisted:  :evil:  :evil:  :arrow: 

 i was wondering if there is a realy simple way to get images into java such as like a .jpeg file cause im sort of bad at java anyone wanna help thanks 

 :?:  :?:  :?:  :?:  :?:  :?:  :!:  :D  :)  :(  :o  :shock:  :?  8)  :lol:  :oops:  :P  :x  :cry:  :wink:  :roll:  :idea:  :twisted:  :evil:  :evil:  :arrow:

-----------------------------------
Dan
Fri May 07, 2004 12:09 pm


-----------------------------------
There is no need to use that many emoticons in a post and deftly not one asking for help. U do not even use them in any context, just randomly picking them. Overdoing it with emoticons slows down the load time of the page and this may not seem like a big isues to you but it is for poleop wiht slow speed and for this site b/c it uses up more bandwith withc means more $.


Any how now that my rant is done, what do you mean by simple? If by that u mean not using awt or swing, then i do not think there is a way to do graficks in prue java with out them (or at least not easly). If you whont some graficks you are going to have to get in to the awt API stuff, just can not do graficks in the consloe (well at least not easly or have them look or run good).

-----------------------------------
ify
Fri May 07, 2004 1:43 pm

nm i figured it out
-----------------------------------
nevermind[/b]

-----------------------------------
communismisntdead
Mon May 10, 2004 9:10 am


-----------------------------------
See my post in the 'Image in HSA Console' thread. It might help. 

HackerDan, no offense, but lighten up, its just a bunch of emoticons, who cares?...

-----------------------------------
jono11
Mon May 10, 2004 9:11 am

Meh
-----------------------------------
Hacker Dan, I'm sure he appreciates the help but lighten up on the guy a bit. He's probably some inferior programmer who has no idea about technical terms. Dont let it get under your skin. They are just stupid emoticons. Party on Wayne... 


 :D  :)  :(  :o  :shock:  :?  8)  :lol:  :cry:  :oops:  :P  :x  :evil:  :twisted:  :roll:  :wink:  :arrow:  :idea:  :?:  :!:

-----------------------------------
Dan
Mon May 10, 2004 4:54 pm


-----------------------------------
Your school or w/e is starting to realy push it with the spaming, i mean almost all the users who post from your ip seem to be masive spamers...

Plz tell your frends to stop b/c i dont whont to block your ip ragne or delete all the users who post from that ip.


Any how:

See my post in the 'Image in HSA Console' thread. It might help. 

the HSA console is not real java, it is an unstareted libbray for ready to progame. I whould highly reocmened not using it unless u have to.

-----------------------------------
communismisntdead
Tue May 18, 2004 1:35 pm


-----------------------------------
Yeah.. too bad none of these people are from my school. 

I said it 'might help', I didn't say it's the answer to life's questions. Just trying to help (remember how to do that?)

-----------------------------------
Dan
Tue May 18, 2004 4:00 pm


-----------------------------------
Just trying to help (remember how to do that?)

That could be interptited as an insulet. Are you trying to impley that i do not help any one on this site?

Also do you go to Centre Dufferin District High School? The logs say your posts and some other poleops like jono11 are coming from the same place. Witch looks like it is from a high school, posably called Centre Dufferin District. If you are not from the same school as them, it inrests me as to why you whould be posting from the same ip.

-----------------------------------
communismisntdead
Wed May 19, 2004 8:38 pm


-----------------------------------
Yes, I suppose that COULD be taken as an insult. I wasn't insinuating that you don't help anyone, just that occasionally you do more harm than good with arrogance. Which is not always a bad thing. No insults intended. 

And why would you find out our ip's? Do you have a life?

-----------------------------------
Dan
Wed May 19, 2004 8:46 pm


-----------------------------------
while there is a system to check ips betwen users so i know if one person is singing up for like 100 user acounts. Also the ip buttion is like right above your post when u are a mod so it is not like it is hard to do (it is stander practices to check ips of users who could be pentaily disroptive to the comunity)

Also i may some times seem arrogant but if no one trys inforce the rules this hole site will turn in to the spam area.

-----------------------------------
communismisntdead
Fri May 21, 2004 10:09 am


-----------------------------------
Yes, I know what you mean. It just seemed that you were being jerk, but you are right, order must be kept... In any case lets set aside our differences, help, and be helped. That's what this place is for.

-----------------------------------
Flashkicks
Wed May 26, 2004 7:48 am


-----------------------------------
Id have to completely agree with HackerDan- Just bcuz he is trying to do whats right and what the site really needs, every ones mad at him..  Just like how EVERYONE [almost] hates cops.. WHY??..  bcuz they are doing thier JOB...  im sure you get my point.  Either way- i need help with this same topic.  My question; just in simple terms- how do you insert a pic [bmp, jpeg] into Java; preferably an applet.  I am working on our school website-ish and I am supposed to have an applet and I have pics to put in it- its a Math type thingy.  So how can I upload all my graphs and whatnot to the applet?  Some sample coding would be REAL nice...  Seeing how Iv never done this before...

-----------------------------------
Dan
Thu May 27, 2004 2:47 pm


-----------------------------------
To load an image file in to the progame u can use this comand:


Image myImage = getToolkit().getImage(filename);


Where filename is a string.

This gets the data in but displaing it is another matter. To display any graficks (like lines, ect) you need a paint method like this:


public void paint(Graphics g) 
{
        g.drawImage(myimage, x, y, this);
}


-----------------------------------
Flashkicks
Fri May 28, 2004 7:29 am


-----------------------------------
Thanks very much- i messed around with it and came up with this; The image SOMETIMES loads...  :S  And when it does- it takes YEARS to load...   Do you understand Why at all??...  Here is my coding; import java.awt.*;

public class LoadFrameImage extends Frame
{
    Image img;
    //Constructor loads the pic, sets the frames size and makes the Frame appear.
    public LoadFrameImage ()
    {
        img = getToolkit ().getImage ("building.jpeg");
        System.out.println (img);
        setSize (300, 300);
        show ();
    } //Constructor


    //Called when Frame needs to be repainted
    public void paint (Graphics g)
    {
        g.drawImage (img, 50, 50, null);
    } //Paint method


    //the main method called when proggy is executed.
    //Creates a single copy of the LoadFrameImage window
    public static void main (String [] args)
    {
        new LoadFrameImage ();
    }
} //LoadImage class


~Flashkicks

-----------------------------------
Dan
Fri May 28, 2004 10:47 pm


-----------------------------------
There are many ways to load pics in java deponding on alot of things, but most are about that long for simple ones, for my RPG FP in java i am working on the buffering system is serveral pages of code.

It is not b/c java is a bad lang, it just gives u alot more contorl over it and it also uses the conspects of OOP witch make some things seem a bit complected.

This is a very very very simplifed verson of the way i do it in my FP:


import java.awt.*;
import javax.swing.*;
import java.awt.image.*;

public class TestingPic
{
	public static void main(String args[])
	{
		JFrame frame = new JFrame();
		MyPanel panel = new MyPanel("test.jpg");
		
        frame.setContentPane(panel);
        frame.setDefaultCloseOperation(3);
        frame.setBounds(new Rectangle(500, 500));
        frame.setVisible(true);

        panel.repaint();
	}
}

class MyPanel extends JComponent
{
	private Image myImage;
	
	public MyPanel(String imageName)
	{
		super();
		setImage(imageName);
	}
	
	public void paint(Graphics g)
	{
		super.paint(g);
		g.drawImage(myImage, 0, 0, this);
	}
	
	public void setImage(String fileName)
	{
		myImage = getToolkit().getImage(fileName);
	}
}


It loads prity fast, alougth it is in the from of an appliaction and not a applet. I think it should be easy to modify it to be an applet.

Honstly i am not the best person to talk about java awt and swing stuff, i have just been geting in to it my self this year. May be you can find our java mod around and ask him about it if u need more info.

-----------------------------------
Flashkicks
Mon May 31, 2004 7:49 am


-----------------------------------
Hey- Thank you very much Dan.  You may not think you know that much about Java; but it was enough to help.  Once again- thank you for your time and patience..  I got my thingy majiggies to properly work!!! :D 
~Flashkicks
