Welcome to Dream.In.Code
Become a Java Expert!

Join 150,033 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,587 people online right now. Registration is fast and FREE... Join Now!




How do you implement pictures?

 
Reply to this topicStart new topic

How do you implement pictures?

khold
8 Jun, 2008 - 01:02 AM
Post #1

New D.I.C Head
*

Joined: 26 May, 2008
Posts: 8

I don't know the code or calling an image file into code, or whatever packmage I may need to import. Can anyone help me?
User is offlineProfile CardPM
+Quote Post

mensahero
RE: How Do You Implement Pictures?
8 Jun, 2008 - 02:22 AM
Post #2

c0mput3rz Are Only Human
Group Icon

Joined: 26 May, 2008
Posts: 664



Thanked: 17 times
Dream Kudos: 75
My Contributions
Hello.. hope this helps.. blink.gif

How to load an IMAGE
User is offlineProfile CardPM
+Quote Post

khold
RE: How Do You Implement Pictures?
8 Jun, 2008 - 10:44 AM
Post #3

New D.I.C Head
*

Joined: 26 May, 2008
Posts: 8

thank you.
User is offlineProfile CardPM
+Quote Post

mensahero
RE: How Do You Implement Pictures?
8 Jun, 2008 - 10:58 AM
Post #4

c0mput3rz Are Only Human
Group Icon

Joined: 26 May, 2008
Posts: 664



Thanked: 17 times
Dream Kudos: 75
My Contributions
QUOTE(khold @ 8 Jun, 2008 - 11:44 AM) *

thank you.


blink.gif thanks.. goodluck.. biggrin.gif

User is offlineProfile CardPM
+Quote Post

khold
RE: How Do You Implement Pictures?
8 Jun, 2008 - 03:00 PM
Post #5

New D.I.C Head
*

Joined: 26 May, 2008
Posts: 8

I have another question though.

How do you call the pictures into the program? What does the URL have to be exactly?

I tried calling an image from a folder on my computer, then a UR from the internet, and tried calling it but it didn't work.

CODE

// this is where I tested out the code
import javax.swing.*;
import java.awt.*;

public class PlayerImages
{
private static final ImageIcon image = new ImageIcon ( "images/kirbyspawn(copy).jpg" );

public PlayerImages()
{
}

public static ImageIcon getImage()
{
return image;
}
}


CODE

// and this is where I tried to implement it later

PlayerImages one = new PlayerImages();

...

public static void main(String[] args) throws IOException // runs the game
{
System.out.println("Welcome to Roulette!");
one.getImage();

int numPlayers = getNumPlayers(); // gets number of players
int startChamber = spinCylinder(); // generates a random starting chamber
int bulletChamber = spinCylinder(); // generates a random chamber for the bullet

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 09:40PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month