[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Windows XP weirdness with Applets
I have this applet that when ran under IE in Windows XP it sometimes
royally screws up the border around the text in the screen.
/**
* Overides the paint method. Used here to draw a
* border around out label
* @param g Graphics
*/
public void paint(Graphics g) {
Rectangle rect = clockText.getBounds();
int brd = Integer.parseInt(brdSize);
if(brd < MINIMUM_BRD_SIZE)
brd = MINIMUM_BRD_SIZE;
if(brd > MAXIMUM_BRD_SIZE)
brd = MAXIMUM_BRD_SIZE;
g.setColor(foreGround);
this.setBackground(backGround);
this.setForeground(foreGround);
for(int i=1; i <= brd; i++)
{
g.drawRect(rect.x - i, rect.y - i,
rect.width + (i *2), rect.height + (i *2));
}
}
Unde IE in any other Windows platform this does not cause a problem.
Sometimes the border will disappear and I can see right through it to
the desktop. I've installed JRE 1.4.1_01 on the Windows machine. This
code was compiled with a target of 1.1. Is there a good way to fix
this? Or when I update clockText in the thread should I just call the
paint() method so that the graphics could be updated. This is a simple
clock applet with the clock displayed as a
Label clockText = new Label("", Label.CENTER); // Label that
displays time
Every second that label gets updated. Maybe every second after I update
the label I should run paint()?
Thanks,
Chris