1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Different results firefox/chrome/ie

Discussion in 'Java' started by chimerical26, Dec 1, 2010.

  1. chimerical26

    chimerical26 New Member

    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 );
       }
    
    }
     
    Last edited by a moderator: Dec 1, 2010
  2. chimerical26

    chimerical26 New Member

    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>
     

Share This Page