gg.msn.ui.form.LicenseDialog.java Source code

Java tutorial

Introduction

Here is the source code for gg.msn.ui.form.LicenseDialog.java

Source

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * LicenseDialog.java
 *
 * Created on 10-set-2009, 12.11.49
 */
package gg.msn.ui.form;

import java.io.IOException;
import java.net.URL;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 *
 * @author Luigi
 */
public class LicenseDialog extends javax.swing.JDialog {

    private Log log = LogFactory.getLog(LicenseDialog.class);

    /** Creates new form LicenseDialog */
    public LicenseDialog(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();

        try {
            URL resource = getClass().getResource("config.html");
            log.debug("URL [" + resource + "]");
            log.debug(licenseTextPane.getPage());
            licenseTextPane.setPage(resource);
        } catch (IOException ex) {
            log.error(ex);
        } catch (Exception ex) {
            log.error(ex);
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jEditorPane1 = new javax.swing.JEditorPane();
        licenseLabel = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        licenseTextPane = new javax.swing.JEditorPane();

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        jEditorPane1.setName("jEditorPane1"); // NOI18N
        jScrollPane1.setViewportView(jEditorPane1);

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setName("Form"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application
                .getInstance(gg.msn.ui.ChatClientApp.class).getContext().getResourceMap(LicenseDialog.class);
        licenseLabel.setFont(resourceMap.getFont("licenseLabel.font")); // NOI18N
        licenseLabel.setText(resourceMap.getString("licenseLabel.text")); // NOI18N
        licenseLabel.setName("licenseLabel"); // NOI18N

        jScrollPane2.setName("jScrollPane2"); // NOI18N

        licenseTextPane.setName("licenseTextPane"); // NOI18N
        jScrollPane2.setViewportView(licenseTextPane);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(
                                layout.createSequentialGroup().addContainerGap()
                                        .addGroup(layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        545, Short.MAX_VALUE)
                                                .addComponent(licenseLabel))
                                        .addContainerGap()));
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup().addContainerGap().addComponent(licenseLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 296, Short.MAX_VALUE)
                        .addContainerGap()));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                LicenseDialog dialog = new LicenseDialog(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {

                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JEditorPane jEditorPane1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JLabel licenseLabel;
    private javax.swing.JEditorPane licenseTextPane;
    // End of variables declaration//GEN-END:variables
}