jQuery in Action, 3rd edition
The moose likes Applets and the fly likes Multiple applets in page overlapping. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Multiple applets in page overlapping." Watch "Multiple applets in page overlapping." New topic

Multiple applets in page overlapping.

Brett Fitzgerald

Joined: Mar 21, 2006
Posts: 6
Hey everyone. I'm working on a project, involving a weather station updating a website. Currently, the site is online at http://www.weather.seniordesignprojects.com if you want to take a look for reference. Basically, there are three applets on that page. One displays some labels about the current weather (weather in my study, that is, with a fan blowing on the wind meter), and the other two are 24-hour history graphs of wind and temperature. I seem to have a problem displaying the two graphs. They are simply hand-made graphs used by drawing lines and such. It seems that one graph is always displayed twice, in both locations, and the other is displayed once, in it's proper location. The result is one location has both applets displaying on it. This happens in IE and Firefox. Does anyone know what causes this or what I can do to fix it? Thanks in advance!

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Using Java 1.4 with both FireFox and IE only the first applet comes up OK. At least one of the others throws an exception, after which the browser tilts:

java.lang.Error: Do not use TempHistoryApp.add() use TempHistoryApp.getContentPane().add() instead
at javax.swing.JApplet.createRootPaneException(Unknown Source)
at javax.swing.JApplet.addImpl(Unknown Source)
at java.awt.Container.add(Unknown Source)
at TempHistoryApp.init(TempHistoryApp.java:23)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

That might be a good start for investigation.
[ April 12, 2006: Message edited by: Ulf Dittmer ]
Matias Turteltaub

Joined: Apr 22, 2006
Posts: 1
The following information may be of use to you.
I have a web page with 12 frames. On each frame there is an instance of a Java applet. Each instance uses a different port.
Each instance has a menu that is activated by moving the mouse on top of the applet.
Sometimes, the same image appears on two different frames, which is the same problem you have. Moreover, when that happens, moving the mouse on top of one image activates the menu on the second image.

The first conclusion is that the phenomenon has little to do with the applet itself, although it could be triggered by some java feature used in both cases.

Second, I have found that usually, after refreshing the applets two or three times, the phenomenon disappears.
I hope this helps, and if you find anything, please email me.
I agree. Here's the link: http://aspose.com/file-tools
subject: Multiple applets in page overlapping.
jQuery in Action, 3rd edition