Solved

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

Posted on 2002-04-09
10
189 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

759 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

18 Experts available now in Live!

Get 1:1 Help Now