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

Username:   Password: 
 RegisterRegister   
 need help in changing a dot image to a .PNG image on the resource folder
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
von5leyz




PostPosted: Sun Nov 20, 2011 7:09 am   Post subject: need help in changing a dot image to a .PNG image on the resource folder

//need help in changing a dot image to a .PNG image on the resource folder
//how can i change the code below and make it a code that instead of creating a dot image it will create or call the .PNG image file on the resource folder
// below is the source code


package pucman;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.*;

public class Dot extends Sprite {

protected int score;
protected static Image dotImage;
//protected static Image gennumber;

public int getScore()
{
return score;
}
public static Image getImage()
{
try
{
//gennumber = Image.createImage(8,8);
dotImage = Image.createImage(6,6);
Graphics g = dotImage.getGraphics();
// Graphics g = gennumber.getGraphics();
g.setColor(0xffffffff);
g.fillRect(0, 0, dotImage.getWidth(), dotImage.getHeight());
}
catch (Exception e)
{
System.err.println("Error loading dot image");
return null;
}
//return dotImage;
return dotImage;
}

public Dot(Position position)
{

super(getImage());
this.score = 10;
setPosition(position.getX()-getWidth()/2,position.getY()-getHeight()/2);
}


}
Sponsor
Sponsor
Sponsor
sponsor
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  [ 1 Posts ]
Jump to:   


Style:  
Search: