Solved

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

Posted on 2002-04-09
10
191 Views
Last Modified: 2010-03-31
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
0
Comment
Question by:delphi3
  • 6
  • 4
10 Comments
 
LVL 16

Expert Comment

by:heyhey_
ID: 6930623
print the image sizes after they are "loaded"

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

Author Comment

by:delphi3
ID: 6931089
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
0
 
LVL 4

Author Comment

by:delphi3
ID: 6935539
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
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 4

Author Comment

by:delphi3
ID: 6935548
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
0
 
LVL 16

Accepted Solution

by:
heyhey_ earned 50 total points
ID: 6936206
you can delete the question now :)

> Yes there is a blue applet area.

you have to install JDK 1.1 and configure Kawa to use it.
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 6936539
thanks for the points !
0
 
LVL 4

Author Comment

by:delphi3
ID: 6936549
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
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 6936563
thanks for the points !
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 6936579
thanks for the points !
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 6936583
ooops, stupid browsers :(
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now