001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.license;
043:
044: import java.io.IOException;
045: import java.net.URL;
046: import java.util.ResourceBundle;
047:
048: import org.openide.util.NbBundle;
049:
050: /**
051: * This class displays license during first start of IDE.
052: *
053: * @author Marek Slama
054: */
055: final class LicensePanel extends javax.swing.JPanel {
056:
057: /** Creates new form LicensePanel */
058: public LicensePanel(URL url) {
059: this .url = url;
060: initComponents();
061: initAccessibility();
062: try {
063: jEditorPane1.setPage(url);
064: } catch (IOException exc) {
065: //Problem with locating file
066: System.err.println("Exception: " + exc.getMessage()); //NOI18N
067: exc.printStackTrace();
068: }
069: }
070:
071: private void initAccessibility() {
072: this .getAccessibleContext().setAccessibleName(
073: bundle.getString("ACSN_LicensePanel"));
074: this .getAccessibleContext().setAccessibleDescription(
075: bundle.getString("ACSD_LicensePanel"));
076:
077: jEditorPane1.getAccessibleContext().setAccessibleName(
078: bundle.getString("ACSN_EditorPane"));
079: jEditorPane1.getAccessibleContext().setAccessibleDescription(
080: bundle.getString("ACSD_EditorPane"));
081: }
082:
083: /** This method is called from within the constructor to
084: * initialize the form.
085: * WARNING: Do NOT modify this code. The content of this method is
086: * always regenerated by the Form Editor.
087: */
088: // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
089: private void initComponents() {
090: jTextAreaTop = new javax.swing.JTextArea();
091: jScrollPane1 = new javax.swing.JScrollPane();
092: jEditorPane1 = new javax.swing.JEditorPane();
093: jTextAreaBottom = new javax.swing.JTextArea();
094:
095: setLayout(new javax.swing.BoxLayout(this ,
096: javax.swing.BoxLayout.Y_AXIS));
097:
098: setBorder(javax.swing.BorderFactory.createEmptyBorder(12, 12,
099: 0, 11));
100: jTextAreaTop.setBackground(getBackground());
101: jTextAreaTop.setColumns(20);
102: jTextAreaTop.setEditable(false);
103: jTextAreaTop.setFont(new java.awt.Font("Dialog", 1, 12));
104: jTextAreaTop.setLineWrap(true);
105: jTextAreaTop.setRows(1);
106: jTextAreaTop
107: .setText(bundle.getString("MSG_LicenseDlgLabelTop"));
108: jTextAreaTop.setWrapStyleWord(true);
109: jTextAreaTop.setFocusable(false);
110: jTextAreaTop.setMargin(new java.awt.Insets(0, 0, 2, 0));
111: jTextAreaTop.setRequestFocusEnabled(false);
112: add(jTextAreaTop);
113:
114: jEditorPane1.setEditable(false);
115: jEditorPane1.setPreferredSize(new java.awt.Dimension(500, 500));
116: jScrollPane1.setViewportView(jEditorPane1);
117:
118: add(jScrollPane1);
119:
120: jTextAreaBottom.setBackground(getBackground());
121: jTextAreaBottom.setColumns(20);
122: jTextAreaBottom.setEditable(false);
123: jTextAreaBottom.setFont(new java.awt.Font("Dialog", 1, 12));
124: jTextAreaBottom.setLineWrap(true);
125: jTextAreaBottom.setRows(2);
126: jTextAreaBottom.setText(bundle
127: .getString("MSG_LicenseDlgLabelBottom"));
128: jTextAreaBottom.setWrapStyleWord(true);
129: jTextAreaBottom.setFocusable(false);
130: jTextAreaBottom.setRequestFocusEnabled(false);
131: add(jTextAreaBottom);
132:
133: }// </editor-fold>//GEN-END:initComponents
134:
135: // Variables declaration - do not modify//GEN-BEGIN:variables
136: private javax.swing.JEditorPane jEditorPane1;
137: private javax.swing.JScrollPane jScrollPane1;
138: private javax.swing.JTextArea jTextAreaBottom;
139: private javax.swing.JTextArea jTextAreaTop;
140: // End of variables declaration//GEN-END:variables
141: private URL url;
142: private static final ResourceBundle bundle = NbBundle
143: .getBundle(LicensePanel.class);
144: }
|