001: /*
002: * $RCSfile: PackageInfo.java,v $
003: *
004: * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * Redistribution and use in source and binary forms, with or without
007: * modification, are permitted provided that the following conditions
008: * are met:
009: *
010: * - Redistribution of source code must retain the above copyright
011: * notice, this list of conditions and the following disclaimer.
012: *
013: * - Redistribution in binary form must reproduce the above copyright
014: * notice, this list of conditions and the following disclaimer in
015: * the documentation and/or other materials provided with the
016: * distribution.
017: *
018: * Neither the name of Sun Microsystems, Inc. or the names of
019: * contributors may be used to endorse or promote products derived
020: * from this software without specific prior written permission.
021: *
022: * This software is provided "AS IS," without a warranty of any
023: * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
024: * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,
025: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY
026: * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL
027: * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF
028: * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
029: * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR
030: * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL,
031: * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND
032: * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR
033: * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
034: * POSSIBILITY OF SUCH DAMAGES.
035: *
036: * You acknowledge that this software is not designed, licensed or
037: * intended for use in the design, construction, operation or
038: * maintenance of any nuclear facility.
039: *
040: * $Revision: 1.3 $
041: * $Date: 2007/02/09 17:21:46 $
042: * $State: Exp $
043: */
044:
045: package org.jdesktop.j3d.examples.package_info;
046:
047: import javax.swing.JTextArea;
048:
049: public class PackageInfo extends javax.swing.JFrame {
050:
051: private void pkgInfo(JTextArea textArea, ClassLoader classLoader,
052: String pkgName, String className) {
053:
054: try {
055: classLoader.loadClass(pkgName + "." + className);
056:
057: Package p = Package.getPackage(pkgName);
058: if (p == null) {
059: textArea.append("WARNING: Package.getPackage("
060: + pkgName + ") is null\n");
061: } else {
062: textArea.append(p.toString() + "\n");
063: textArea.append("Specification Title = "
064: + p.getSpecificationTitle() + "\n");
065: textArea.append("Specification Vendor = "
066: + p.getSpecificationVendor() + "\n");
067: textArea.append("Specification Version = "
068: + p.getSpecificationVersion() + "\n");
069:
070: textArea.append("Implementation Vendor = "
071: + p.getImplementationVendor() + "\n");
072: textArea.append("Implementation Version = "
073: + p.getImplementationVersion() + "\n");
074: }
075: } catch (ClassNotFoundException e) {
076: textArea.append("Unable to load " + pkgName + "\n");
077: }
078:
079: textArea.append("\n");
080: }
081:
082: /**
083: * Creates new form PackageInfo
084: */
085: public PackageInfo() {
086: initComponents();
087:
088: ClassLoader classLoader = getClass().getClassLoader();
089:
090: pkgInfo(myTextArea, classLoader, "javax.vecmath", "Point3d");
091: pkgInfo(myTextArea, classLoader, "javax.media.j3d",
092: "SceneGraphObject");
093: pkgInfo(myTextArea, classLoader, "com.sun.j3d.utils.universe",
094: "SimpleUniverse");
095: }
096:
097: // ----------------------------------------------------------------
098:
099: /** This method is called from within the constructor to
100: * initialize the form.
101: * WARNING: Do NOT modify this code. The content of this method is
102: * always regenerated by the Form Editor.
103: */
104: // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
105: private void initComponents() {
106: jScrollPane1 = new javax.swing.JScrollPane();
107: myTextArea = new javax.swing.JTextArea();
108:
109: setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
110: setTitle("Package Info");
111: jScrollPane1.setPreferredSize(new java.awt.Dimension(400, 400));
112: myTextArea.setColumns(20);
113: myTextArea.setEditable(false);
114: myTextArea.setRows(5);
115: jScrollPane1.setViewportView(myTextArea);
116:
117: getContentPane()
118: .add(jScrollPane1, java.awt.BorderLayout.CENTER);
119:
120: pack();
121: }// </editor-fold>//GEN-END:initComponents
122:
123: /**
124: * @param args the command line arguments
125: */
126: public static void main(String args[]) {
127: java.awt.EventQueue.invokeLater(new Runnable() {
128: public void run() {
129: new PackageInfo().setVisible(true);
130: }
131: });
132: }
133:
134: // Variables declaration - do not modify//GEN-BEGIN:variables
135: private javax.swing.JScrollPane jScrollPane1;
136: private javax.swing.JTextArea myTextArea;
137: // End of variables declaration//GEN-END:variables
138:
139: }
|