Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2002-04-09
10
Medium Priority
?
196 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 200 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

610 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