Link to home
Start Free TrialLog in
Avatar of delphi3
delphi3

asked on

Images not appearing on IE - 6.00.2600.0000 andJava - Kawa Version 3.2

Hi All,
I have  :  IE - 6.00.2600.0000    and      Java - Kawa Version 3.2. Seems that no matter what I do I cannot get the images that are in my applet to show up on my browser. Yes there is a blue applet area.  Is there any way to get this to happen with the program below?

Both the gifs are in the folder with the .class  

<HTML>
<applet code="NormalSine.class" width="500" height="200"></applet>
</HTML>


import java.applet. * ;
import java.awt. * ;
import java.net. * ;
import java.awt.event. * ;


public class NormalSine extends Applet {
      Image imageBG1;
      Image imageBG2;
      MediaTracker mt;
      private java.awt.Point clickPoint = null;
      public void init() {
            setBackground(Color.blue);
            URL baseURL = getCodeBase();

            addMouseListener(
            new MouseAdapter() {

                  public void mousePressed(MouseEvent event) {
                        clickPoint = event.getPoint();
                        repaint();
                  }
            });

            try {
                  imageBG1 = getImage(baseURL, "Pattern0.gif");
                  imageBG2 = getImage(baseURL, "Pattern1.gif");
                  mt = new MediaTracker(this);
                  mt.addImage(imageBG1, 1);
                  mt.addImage(imageBG2, 2);
                  if (mt.isErrorAny()) {
                        System.out.println("Media error occurred 1.");
                        imageBG1 = null;
                        imageBG2 = null;
                  }
                  mt.waitForAll();
                  if (mt.isErrorAny()) {
                        System.out.println("Media error occurred 2.");
                        imageBG1 = null;
                        imageBG2 = null;
                  }
            } catch (Exception e) {
                  mt = null;
                  System.out.println("Could not do image!");
                  imageBG1 = null;
                  imageBG2 = null;
            }

      }
      int k = 17 ;
      int[] arrayOfInts1 = new int[k];
   // the images are 25 by 99,I Think :)
   // there is a need to expand this to 17 images wide.


      public void paint(Graphics g) {
            for (int i = 1; i < k; i++) {
                  g.drawImage(imageBG1,i * 25 + 1,5,25,98, this);
            }
            if (clickPoint != null) {
                  int X = (int)clickPoint.getX();

                  if ((X > 0) && (X < 51)) {
                        X = 25; if (arrayOfInts1 [0] > 1) {arrayOfInts1 [0] = 0;}
                 else if (arrayOfInts1 [0] < 1) {arrayOfInts1 [0] = X;}

                  } else if ((X > 24) && (X < 76)) {
                        X = 50;    if (arrayOfInts1 [1] > 1) {arrayOfInts1 [1] = 0;}
                 else if (arrayOfInts1 [1] < 1) {arrayOfInts1 [1] = X;}

                  } else if ((X > 49) && (X < 101)) {
                        X = 75;
                if (arrayOfInts1 [2] > 1) {arrayOfInts1 [2] = 0;}
                 else if (arrayOfInts1 [2] < 1) {arrayOfInts1 [2] = X;}

                  } else if ((X > 74) && (X < 126)) {
                        X = 100;
                 if (arrayOfInts1 [3] > 1) {arrayOfInts1 [3] = 0;}
                 else if (arrayOfInts1 [3] < 1) {arrayOfInts1 [3] = X;}

                  } else if ((X > 99) && (X < 151))  {
                        X = 125;
                if (arrayOfInts1 [4] > 1) {arrayOfInts1 [4] = 0;}
                 else if (arrayOfInts1 [4] < 1) {arrayOfInts1 [4] = X;}

                  } else if ((X > 124) && (X < 176)) {
                        X = 150;    if (arrayOfInts1 [5] > 1) {arrayOfInts1 [5] = 0;}
                 else if (arrayOfInts1 [5] < 1) {arrayOfInts1 [5] = X;}

                  } else if ((X > 149) && (X < 201)) {
                        X = 175;
                if (arrayOfInts1 [6] > 1) {arrayOfInts1 [6] = 0;}
                 else if (arrayOfInts1 [6] < 1) {arrayOfInts1 [6] = X;}

                  } else if ((X > 174) && (X < 226)) {
                        X = 200;
                 if (arrayOfInts1 [7] > 1) {arrayOfInts1 [7] = 0;}
                 else if (arrayOfInts1 [7] < 1) {arrayOfInts1 [7] = X;}

                  } else if (X > 199 && (X < 251)) {
                        X = 225;
                if (arrayOfInts1 [8] > 1) {arrayOfInts1 [8] = 0;}
                 else if (arrayOfInts1 [8] < 1) {arrayOfInts1 [8] = X;}

                  } else if ((X > 224) && (X < 276)) {
                        X = 250;
                if (arrayOfInts1 [9] > 1) {arrayOfInts1 [9] = 0;}
                 else if (arrayOfInts1 [9] < 1) {arrayOfInts1 [9] = X;}

                  } else if ((X > 249) && (X < 301)) {
                        X = 275;
                if (arrayOfInts1 [10] > 1) {arrayOfInts1 [10] = 0;}
                 else if (arrayOfInts1 [10] < 1) {arrayOfInts1 [10] = X;}

                  } else if ((X > 274) && (X < 326)) {
                        X = 300;
                 if (arrayOfInts1 [11] > 1) {arrayOfInts1 [11] = 0;}
                 else if (arrayOfInts1 [11] < 1) {arrayOfInts1 [11] = X;}

                  } else if ((X > 299) && (X < 351)) {
                        X = 325;
                if (arrayOfInts1 [12] > 1) {arrayOfInts1 [12] = 0;}
                 else if (arrayOfInts1 [12] < 1) {arrayOfInts1 [12] = X;}

                  } else if ((X > 324) && (X < 376)) {
                        X = 350;
                if (arrayOfInts1 [13] > 1) {arrayOfInts1 [13] = 0;}
                 else if (arrayOfInts1 [13] < 1) {arrayOfInts1 [13] = X;}

                  } else if ((X > 349) && (X < 401)) {
                        X = 375;
                if (arrayOfInts1 [14] > 1) {arrayOfInts1 [14] = 0;}
                 else if (arrayOfInts1 [14] < 1) {arrayOfInts1 [14] = X;}

                  } else if ((X > 374) && (X < 426)) {
                        X = 400;
                 if (arrayOfInts1 [15] > 1) {arrayOfInts1 [15] = 0;}
                 else if (arrayOfInts1 [15] < 1) {arrayOfInts1 [15] = X;}

                  } else if ((X > 399) && ( X < 451)) {
                        X = 425;
                if (arrayOfInts1 [16] > 1) {arrayOfInts1 [16] = 0;}
                 else if (arrayOfInts1 [16] < 1) {arrayOfInts1 [16] = X;}
            }

                  for (int c = 0; c < k - 1; c++) {
                        if (arrayOfInts1[c] > 0) {
                              g.drawImage(imageBG2,arrayOfInts1[c],5,25,98, this);
                              System.out.println(c + 1 + " " + arrayOfInts1[c + 1]);
                        }
                  }
            }

      }
}




Delphi3
Avatar of heyhey_
heyhey_

print the image sizes after they are "loaded"

System.out.println("" + imageBG1.getWidth(null));
Avatar of delphi3

ASKER

heyhey,
I placed it here
     } catch (Exception e) {
               mt = null;
               System.out.println("Could not do image!");
               imageBG1 = null;
               imageBG2 = null;
          }

                System.out.println("" + imageBG1.getWidth(null));


is that where you intended I should add it?

Delphi3
Avatar of delphi3

ASKER

heyhey.
The comment you provided was of no use to me.
Sorry.
What I discoverd on my own was that this line
        if (clickPoint != null) {
                                int X = (int)clickPoint.getX();
should have been:
 
        if (clickPoint != null) {
                                int X = (int)clickPoint.x();


I appreciate you answering and maybe in the future we can connect so that points can come your way

Thanks again.

Delphi3
Avatar of delphi3

ASKER

The solution provided was of no value to me and others could have commented but did not.

I showed the person my solution and thanked him accordingly.

Delphi3
ASKER CERTIFIED SOLUTION
Avatar of heyhey_
heyhey_

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks for the points !
Avatar of delphi3

ASKER

heyhey,

But I realized before the delete, what is here is on value to someone else.  So I changed my mind.  Saved it for the record.  The points are yours.  Thanks  for stopping by.


Have a good day and thanks again.
Delphi3
thanks for the points !
thanks for the points !
ooops, stupid browsers :(