/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package deploy.JND; import java.awt.event.WindowEvent; import java.io.FileReader; import java.io.IOException; import javax.swing.text.html.HTMLEditorKit; /** * * @author Will */ public class SimpleHtmlHelpFrame extends javax.swing.JFrame { /** Creates new form SimpleHtmlHelpFrame */ public SimpleHtmlHelpFrame() { GUIGlobals.setLookAndFeel(); initComponents(); this.setLocationRelativeTo(null); htmlPane.setEditorKit(new HTMLEditorKit()); try { String filename = "./html/Help.html"; FileReader reader = new FileReader(filename); htmlPane.read(reader, filename); } catch (IOException ex) { System.err.println("Could not open help page."); ex.printStackTrace(); } } /** 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. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jScrollPane1 = new javax.swing.JScrollPane(); htmlPane = new javax.swing.JTextPane(); closeButton = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Help"); jScrollPane1.setViewportView(htmlPane); closeButton.setText("Close"); closeButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { closeButtonActionPerformed(evt); } }); org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() .addContainerGap() .add(closeButton)) .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 271, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(closeButton)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeButtonActionPerformed this.getToolkit().getSystemEventQueue().postEvent((new WindowEvent(this, WindowEvent.WINDOW_CLOSING))); }//GEN-LAST:event_closeButtonActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new SimpleHtmlHelpFrame().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton closeButton; private javax.swing.JTextPane htmlPane; private javax.swing.JScrollPane jScrollPane1; // End of variables declaration//GEN-END:variables }