Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Java (http://www.go4expert.com/forums/java/)
-   -   Different results firefox/chrome/ie (http://www.go4expert.com/forums/results-firefox-chrome-ie-t24045/)

chimerical26 1Dec2010 09:24

Different results firefox/chrome/ie
 
Hey there,
I am sure this is an issue every java novice comes up against when they start but my java applet is displaying completely differently in firefox than it is in Chrome and IE. It seems as though paint()/repaint isn't working in firefox because I get black text on a black background but when I drag another window over the applet the black background gets filled with the graphics from the window on top. Chrome and IE are fine. Any help?

Code:

import java.awt.*;

public class SalutonApplet extends javax.swing.JApplet {
    String greeting;

    public void init(){
        greeting = "Saluton mondo!";
    }

    @Override
    public void paint(Graphics screen){
        Graphics2D screen2D = (Graphics2D) screen;
        for(int i = 0;i<7;i++){
        screen2D.setColor(Color.black);
        screen2D.drawString(greeting, 100, 100);
        repaint();
        }

    }

    public void repaint( Graphics2D g ) {
      update( g );
  }

}


chimerical26 1Dec2010 09:27

Re: Different results firefox/chrome/ie
 
The html

<html>
<head>
<title>Saluton mondo!</title>
</head>
<body bgcolor="000000" Text="#FF00FF">
<p>This is a Java Applet.</p>
<applet code="SalutonApplet"
codebase="..\\..\\build\\classes"
height="150"
width="300"
>
<p>You need a Java Enabled Browser to see this.</p>
</applet>
</body>
</html>


All times are GMT +5.5. The time now is 02:40.