hallo. I want to ask something to you here. I know this may be easy for you, but this may be difficult for me. I learn new J2ME. I want to know the basics of the programing languages this. I have a case like this:
class DrawImageCanvas extends Canvas {
static Image image;
static Image image2;
static Image image3;
static Image image4;
static Image image5;
static Image image6;
static String string;
int count;
public void paint(Graphics g) {
int width = getWidth();
int height = getHeight();
// Fill the background using black
g.setColor(0xefffff);
g.fillRect(0, 0, width, height);
// Load an image from the MIDlet resources
if (image == null && image2 == null && image3 == null && image4 == null && image5 == null && image6 == null) {
try {
image = Image.createImage("/http.png");
image2 = Image.createImage("/Back.png");
image3 = Image.createImage("/next.png");
image4 = Image.createImage("/refresh.png");
image5 = Image.createImage("/stop.png");
image6 = Image.createImage("/Bookmark.png");
string = new String("Disini tempat halaman web ditampilkan");
} catch (IOException ex) {
g.setColor(0xffffff);
g.drawString("Failed to load image!", 0, 0, Graphics.TOP | Graphics.LEFT);
return;
}
}
g.drawImage(image, 5, 5, Graphics.TOP | Graphics.LEFT);
g.drawImage(image2, 90, 5, Graphics.TOP | Graphics.LEFT);
g.drawImage(image3, 120, 5, Graphics.TOP | Graphics.LEFT);
g.drawImage(image4, 150, 5, Graphics.TOP | Graphics.LEFT);
g.drawImage(image5, 180, 5, Graphics.TOP | Graphics.LEFT);
g.drawImage(image6, 210, 5, Graphics.TOP | Graphics.LEFT);
g.drawString(string, 5, 36, Graphics.TOP | Graphics.LEFT);
}
}
I want to know how do I change the image to be a image button (key function). please help