GamerMax5
Oct 13th, 2006, 07:42 PM
Wow. It's been a while since I last posted here. ^_^
Anywho, I'm writing an applet that will act as a type of dynamice blog for my site. I realize this could be better done in Flash but when you have a POS computer like mine, Applets are the alternative. :blush:
Here is the code I have so far. This is very basic and there isn't a whole lot being displayed here but I'm still developing it.
import java.applet.*;
import java.awt.*;
public class BlogApplet extends Applet{
Font blogFont;
String[] colorState = new String[5];
String currentColorState;
Image[] iconsBlue = new Image[4];
public void init(){
blogFont = new Font("Tahoma", Font.BOLD, 12);
colorState[0] = "Blue";
colorState[1] = "Green";
colorState[2] = "Magenta";
colorState[3] = "Orange";
colorState[4] = "Yellow";
iconsBlue[0] = getImage(getCodeBase(), "computer_24Blue.gif");
iconsBlue[1] = getImage(getCodeBase(), "documents_24Blue.gif");
iconsBlue[2] = getImage(getCodeBase(), "home_24Blue.gif");
iconsBlue[3] = getImage(getCodeBase(), "mail_24Blue.gif");
currentColorState = colorState[0];
}
public void start(){}
public void stop(){}
public void destroy(){}
public void paint(Graphics g){
g.setFont(blogFont);
g.drawString(this.currentColorState, 10, 10);
g.drawImage(iconsBlue[0], 0, 0, this);
}
}
My problem is that the compiler doesn't mark it as a problem, so apparently it isn't, but the last line in the paint method must not be working or it's working and not displaying the image I tell it to because when the applet loads, it displays the current color setting (the g.drawString) but the image is no where to be found in my applet. Medic please! :D Thanks in advance!
Anywho, I'm writing an applet that will act as a type of dynamice blog for my site. I realize this could be better done in Flash but when you have a POS computer like mine, Applets are the alternative. :blush:
Here is the code I have so far. This is very basic and there isn't a whole lot being displayed here but I'm still developing it.
import java.applet.*;
import java.awt.*;
public class BlogApplet extends Applet{
Font blogFont;
String[] colorState = new String[5];
String currentColorState;
Image[] iconsBlue = new Image[4];
public void init(){
blogFont = new Font("Tahoma", Font.BOLD, 12);
colorState[0] = "Blue";
colorState[1] = "Green";
colorState[2] = "Magenta";
colorState[3] = "Orange";
colorState[4] = "Yellow";
iconsBlue[0] = getImage(getCodeBase(), "computer_24Blue.gif");
iconsBlue[1] = getImage(getCodeBase(), "documents_24Blue.gif");
iconsBlue[2] = getImage(getCodeBase(), "home_24Blue.gif");
iconsBlue[3] = getImage(getCodeBase(), "mail_24Blue.gif");
currentColorState = colorState[0];
}
public void start(){}
public void stop(){}
public void destroy(){}
public void paint(Graphics g){
g.setFont(blogFont);
g.drawString(this.currentColorState, 10, 10);
g.drawImage(iconsBlue[0], 0, 0, this);
}
}
My problem is that the compiler doesn't mark it as a problem, so apparently it isn't, but the last line in the paint method must not be working or it's working and not displaying the image I tell it to because when the applet loads, it displays the current color setting (the g.drawString) but the image is no where to be found in my applet. Medic please! :D Thanks in advance!