• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Applet - Browser Display

 
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had written two applets and made them to communicate among each other. But
my problem is, on the click of the button in the html page the first applet goes invisible and the second applet should display. I had added an label to be displayed in the second label. But the label is not displaying. Some
one please help on this display issue.




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



public class AppletCommunication2 extends Applet {
String msg = "";
Label label1;
public void init() {
repaint();
}

public void paint(Graphics g) {
g.drawString(msg, 300, 200);
showStatus(msg);
}
}


 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Technically I think you're not supposed to be able to do that. When an applet loses visibility it's supposed to stop. Even when an applet scrolls outside the visible portion of the web page it is supposed to be stopped, but every browser I tried will in fact let it keep running.

I can get your applet to work if i comment out the setVisible(false) line. Perhaps you could move it to the point after where you wake up the other applet, or you could just erase the contents of the original applet. Or you could replace the original applet with whatever you intended the 2nd applet to do.
 
Nothing? Or something? Like this tiny ad:
Enterprise-grade Excel API for Java
https://products.aspose.com/cells/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!