1 23 24 package org.dbforms.devgui; 25 26 27 33 public class HelpFrame extends javax.swing.JFrame { 34 private javax.swing.JButton closeBtn; 35 private javax.swing.JEditorPane jEditorPane1; 36 private javax.swing.JPanel jPanel4; 37 38 private javax.swing.JScrollPane jScrollPane1; 41 42 45 public HelpFrame() { 46 initComponents(); 47 48 String dbFormsHomeStr = System.getProperty("DBFORMS_HOME"); 49 50 if (dbFormsHomeStr != null) { 51 String fileSeparator = System.getProperties() 52 .getProperty("file.separator"); 53 String helpfilename = dbFormsHomeStr + fileSeparator + "doc" 54 + fileSeparator + "devgui" + fileSeparator 55 + "devgui.html"; 56 57 try { 58 jEditorPane1.setPage("file:" + helpfilename); 59 setTitle("Helpfile: " + helpfilename); 60 } catch (Exception ex) { 61 jEditorPane1.setText("Error: could not load helpfile '" 62 + helpfilename + "'\n" + ex.getMessage()); 63 } 64 65 pack(); 66 } 67 68 this.setSize(520, 500); 69 } 70 71 private void closeBtnActionPerformed(java.awt.event.ActionEvent evt) { this.setVisible(false); 74 } 75 76 77 79 84 private void exitForm(java.awt.event.WindowEvent evt) { this.setVisible(false); 86 } 87 88 89 94 private void initComponents() { jScrollPane1 = new javax.swing.JScrollPane (); 96 jEditorPane1 = new javax.swing.JEditorPane (); 97 jPanel4 = new javax.swing.JPanel (); 98 closeBtn = new javax.swing.JButton (); 99 100 setTitle("DevGui Help"); 101 addWindowListener(new java.awt.event.WindowAdapter () { 102 public void windowClosing(java.awt.event.WindowEvent evt) { 103 exitForm(evt); 104 } 105 }); 106 107 jScrollPane1.setMinimumSize(new java.awt.Dimension (150, 200)); 108 jEditorPane1.setEditable(false); 109 jScrollPane1.setViewportView(jEditorPane1); 110 111 getContentPane() 112 .add(jScrollPane1, java.awt.BorderLayout.CENTER); 113 114 closeBtn.setToolTipText("Close help window"); 115 closeBtn.setText("Close"); 116 closeBtn.addActionListener(new java.awt.event.ActionListener () { 117 public void actionPerformed(java.awt.event.ActionEvent evt) { 118 closeBtnActionPerformed(evt); 119 } 120 }); 121 122 jPanel4.add(closeBtn); 123 124 getContentPane() 125 .add(jPanel4, java.awt.BorderLayout.SOUTH); 126 127 pack(); 128 } 129 130 } 132 | Popular Tags |