package cz.muni.fi.bronchus.gui; import java.net.URL; /* * HelpQuestion.java * * Created on 26. rijen 2004, 9:54 */ /** * * @author EKOCHEM 94 */ public class InfoDialog extends MyCentralizedJDialog { private javax.swing.border.TitledBorder myBorder; private MyResources myResources; /** Creates new form HelpQuestion */ public InfoDialog(java.awt.Frame parent, boolean modal, MyResources res) { super(parent, modal); myResources = res; initComponents(); myBorder=new javax.swing.border.TitledBorder(null, "Border Title", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 0, 11)); } public InfoDialog(javax.swing.JDialog parent, boolean modal, MyResources res) { super(parent, modal); myResources = res; initComponents(); myBorder=new javax.swing.border.TitledBorder(null, "Border Title", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 0, 11)); } /** 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. */ private void initComponents() {//GEN-BEGIN:initComponents jPanel1 = new javax.swing.JPanel(); jPanel2 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); jTextPane1 = new javax.swing.JTextPane(); jPanel3 = new javax.swing.JPanel(); jButton1 = new javax.swing.JButton(); getContentPane().setLayout(new javax.swing.BoxLayout(getContentPane(), javax.swing.BoxLayout.X_AXIS)); setTitle(myResources.getBundle("cz/muni/fi/bronchus/bundles/InfoDialogBundle", "Help")); setFont(new java.awt.Font("Dialog", 0, 11)); jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.Y_AXIS)); jPanel1.setPreferredSize(new java.awt.Dimension(500, 400)); jPanel2.setLayout(new java.awt.BorderLayout()); jPanel2.setBorder(new javax.swing.border.TitledBorder(null, "Border Title", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 0, 11))); jPanel2.setPreferredSize(new java.awt.Dimension(395, 260)); jTextPane1.setEditable(false); jTextPane1.addHyperlinkListener(new javax.swing.event.HyperlinkListener() { public void hyperlinkUpdate(javax.swing.event.HyperlinkEvent evt) { jTextPane1HyperlinkUpdate(evt); } }); jScrollPane1.setViewportView(jTextPane1); jPanel2.add(jScrollPane1, java.awt.BorderLayout.CENTER); jPanel1.add(jPanel2); jButton1.setFont(new java.awt.Font("Dialog", 0, 11)); jButton1.setText(myResources.getBundle("cz/muni/fi/bronchus/bundles/InfoDialogBundle", "Close")); jButton1.setPreferredSize(new java.awt.Dimension(70, 25)); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jPanel3.add(jButton1); jPanel1.add(jPanel3); getContentPane().add(jPanel1); pack(); }//GEN-END:initComponents private void jTextPane1HyperlinkUpdate(javax.swing.event.HyperlinkEvent evt) {//GEN-FIRST:event_jTextPane1HyperlinkUpdate // TODO add your handling code here: if (evt.getEventType()==javax.swing.event.HyperlinkEvent.EventType.ACTIVATED) { try { // System.out.println(evt.getURL()); jTextPane1.setPage(evt.getURL()); } catch (java.io.IOException e) { jTextPane1.setText(myResources.getBundle("cz/muni/fi/bronchus/bundles/InfoDialogBundle","Cannot_find_requested_file")); } } }//GEN-LAST:event_jTextPane1HyperlinkUpdate private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: this.setVisible(false); }//GEN-LAST:event_jButton1ActionPerformed public void setBorderTitle(String title) { myBorder.setTitle(title); jPanel2.setBorder(myBorder); } public void setInnerText(String s) { jTextPane1.setContentType("text/plain"); jTextPane1.setText(s); } public void setInnerHTML(String s) { jTextPane1.setContentType("text/html"); jTextPane1.setText(s); } public void setInnerHTML(URL url) { // jTextPane1.setContentType("text/html"); try { jTextPane1.setPage(url); } catch (Exception e) { jTextPane1.setText(myResources.getBundle("cz/muni/fi/bronchus/bundles/InfoDialogBundle","Error_reading_help_file")+" "+url); } } /** * @param args the command line arguments */ public static void main(String args[]) { InfoDialog a=new InfoDialog(new javax.swing.JFrame(), true, null); a.setVisible(true); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTextPane jTextPane1; // End of variables declaration//GEN-END:variables }