setForeground in Applet does not work (Netbeans under Linux)
I'm attempting to make a Breakout version of java (if I go through with it) and the first issue that I encountered is that I can't change the color of the moving rectangle (you know, the thing you hit the ball with). I tried the code under Textpad on a Windows machine and that worked fine, but not under Netbeans in Linux using jdk 1.6.0_01.
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
publicclass Breakoutextends Appletimplements MouseListener, MouseMotionListener{
int mouse_x, mouse_y;
Thread t;
publicvoid init(){
addMouseListener(this);
addMouseMotionListener(this);
}
publicvoid start(){
t=new Thread();
t.start();
}
publicvoid run(){}
publicvoid mouseClicked(MouseEvent me){}
publicvoid mouseEntered(MouseEvent me){}
publicvoid mouseExited(MouseEvent me){}
publicvoid mousePressed(MouseEvent me){}
publicvoid mouseReleased(MouseEvent me){}
publicvoid mouseDragged(MouseEvent me){}
publicvoid mouseMoved(MouseEvent me){
mouse_x = me.getX();
if(mouse_x>=400)
mouse_x=400;
repaint();
}
publicvoid stop(){}
publicvoid destroy(){}
publicvoid paint(Graphics g){
setBackground(Color.black);
setForeground(Color.white);//doesn't work
g.drawRoundRect(mouse_x, 600, 50, 20, 20, 20);
}
}
I'm wondering if it's because the Applet under Linux uses the Native l&f theme while appets under Windows uses the Windows l&f theme.
Any thoughts would be helpful!

