Different results firefox/chrome/ie

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

  1. chimerical26

    chimerical26 New Member

    Joined:
    Dec 1, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    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

    Joined:
    Dec 1, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    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

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice