EarthWeb
Developer.com
Site
windows 2000
visual c++
java
visual basic
javascripts
recommend it
 
Book
thinking in java
 
Interact
forum
guest book
jobs
jokes
what's new

share code
 
Resource
add resource
modify resource
new resource
 

[Internet Jobs]
-----
Java by E-mail:

Get the weekly e-mail highlights on Java!
-----

-

Detect if Swing is installed


Author: Real Gagnon
Author's WebSite: http://tactika.com/realhome/realhome.html


 public class SwingSniffer extends java.applet.Applet {
   public void init() {  
     try {
       com.sun.java.swing.JButton dummy = 
           new com.sun.java.swing.JButton("foo");
       System.out.println("Swing is here"); 
       // getAppletContext().showDocument
       // (new URL(getCodeBase()+"AppletPageWithNoArchiveTag.html"));
       } 
     catch(NoClassDefFoundError e) {
       System.out.println("Swing is not here, you must download or install it");    
       // getAppletContext().showDocument
       // (new URL(getCodeBase()+"AppletPageWithArchiveTag.html"));
       }
     } 
 }



NOTE: With the JDK1.2 release, it's recommended to use


 import javax.swing.*;

instead of


 import com.sun.java.swing.*;



<HTML><HEAD></HEAD><BODY>
<APPLET CODE="SwingSniffer.class"
HEIGHT=1 WIDTH=1>
<A HREF="/nojava.html">
Oups! You don't have JAVA enabled, click here.</A>
</APPLET>
</BODY></HTML>

Posted On: 5-Jul-1999

internet.commerce
Partner With Us
PDA Phones & Cases
Home Improvement
Car Donations
Free Business Cards
Online Education
Swim at Home,Free DVD
Laptops
Imprinted Gifts
Promote Your Website
Logo Design
Promotional Golf
Desktop Computers
Promotional Products
Online Universities



Acceptable Use Policy

JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers