Applets
public void actionPerformed(ActionEvent event) {
   // check to see if the source of the event was a button
   if(event.getSource() instanceof Button) {
      // do whatever it is you want to do with buttons...
   }
}
Darryl L. Pierce Visit <
http://welcome.to/mcpierce
>
 Q: Could you suggest how to draw one centimeter grid in applet, please? One cm on the screen
must be equal to real cm.
Answer: If you re not all that picky about it, you can always use java.awt.Toolkit s
getScreenResolution() to see how far between the lines should be in the grid....that s assuming the
applet security allows it.
But have it _exactly_ one cm, you can t do, since the user can always adjust the display with the
monitor controls (making the picture wider/taller/whatever), and no computer that I know of can know
those settings.
  
Fredrik Lannergren 
Not only that, the OS (and thus Java) does not know if I am using a 21" or a 14" monitor and thus
can t know the actual physical size of a given number of pixels. By convention, on Windows monitors
are assumed to be either 96dpi or 120dpi (depending on the selection of large or small fonts). Java
usually assumes 72dpi. None of these values is likely to be 
accurate.
  
Mark Thornton
Q: Does anyone know how to or where I can find information about determining if cookies are
disabled on a client browser making a request to a servlet or JSP (or any server side request handler,
for that matter)? Also, is there a way to determine whether or not a client s browser has style sheets
enabled?
Answer: To test if the client has cookies enabled, create a cookie, send it, and read it back. If you
can t read it back, then the client does not accept them. It s not a clean way of doing it, but it s the only
way (that I know if).
As for CSS, there is no way to know if they allow CSS. Different versions of the browsers support
varying levels of CSS. You can get the browser type from the request object and then make decisions
based on that.
 Q: How can two applets communicate with each other? Have you some examples?
Answer: You will occasionally need to allow two or more applets on a Web page to communicate with
each other. Because the applets all run within the same Java context that is, they are all in the same
virtual machine together applets can invoke each other s methods. The AppletContext class has
methods for locating another applet by name, or retrieving all the applets in the current runtime
environment
                                                                 
file:///F|/a_jsite/350_tips/applets.htm (6 of 9) [2001 07 08 11:24:47]






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java web hosting

 

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved