DELOCH
12-24-2007, 07:47 PM
I have a problem with setting a background to JApplet
my code:
import java.awt.geom.*;
import java.awt.*;
import javax.swing.*;
public class Palindrome extends JApplet {
Font f = new Font("Times New Roman", Font.BOLD, 36);
Color color = new Color(25, 200, 144);
public void paint(Graphics g) {
getContentPane().setBackground(Color.black);
g.setColor(Color.white);
g.drawString("Hello World", 30, 30);
}
}
the problem is that nothing shows up until the screen is resized?
strange...
i tried everything, this is the closest i got to it...
small question: JApplet seems to copy the last page when repaints... does this mean that problem will go away if i set a background color?
my code:
import java.awt.geom.*;
import java.awt.*;
import javax.swing.*;
public class Palindrome extends JApplet {
Font f = new Font("Times New Roman", Font.BOLD, 36);
Color color = new Color(25, 200, 144);
public void paint(Graphics g) {
getContentPane().setBackground(Color.black);
g.setColor(Color.white);
g.drawString("Hello World", 30, 30);
}
}
the problem is that nothing shows up until the screen is resized?
strange...
i tried everything, this is the closest i got to it...
small question: JApplet seems to copy the last page when repaints... does this mean that problem will go away if i set a background color?