1 19 20 package org.netbeans.core.ui; 21 22 import java.beans.*; 23 import java.lang.reflect.Constructor ; 24 25 import org.openide.NotifyDescriptor; 26 import org.openide.awt.HtmlBrowser; 27 import org.openide.util.NbBundle; 28 29 31 32 public class SwingBrowser implements HtmlBrowser.Factory, java.io.Serializable { 33 34 35 public static final String PROP_DESCRIPTION = "description"; 37 protected transient PropertyChangeSupport pcs; 38 39 private static final long serialVersionUID = -3735603646171376891L; 40 41 42 public SwingBrowser () { 43 init (); 44 } 45 46 47 private void init () { 48 pcs = new PropertyChangeSupport (this); 49 } 50 51 54 public String getDescritpion () { 55 return NbBundle.getMessage (SwingBrowser.class, "LBL_SwingBrowserDescription"); 56 } 57 58 61 public HtmlBrowser.Impl createHtmlBrowserImpl() { 62 try { 63 Class <?> clz = Class.forName ("org.openide.awt.SwingBrowserImpl"); Constructor con = clz.getDeclaredConstructor (new Class [] {}); 65 con.setAccessible (true); 66 return (HtmlBrowser.Impl)con.newInstance (new Object [] {}); 67 } 68 catch (Exception ex) { 69 org.openide.DialogDisplayer.getDefault ().notify ( 70 new NotifyDescriptor.Message (NbBundle.getMessage (SwingBrowser.class, "MSG_cannot_create_browser")) 71 ); 72 return null; 73 } 74 } 75 76 78 public void addPropertyChangeListener (PropertyChangeListener l) { 79 pcs.addPropertyChangeListener (l); 80 } 81 82 84 public void removePropertyChangeListener (PropertyChangeListener l) { 85 pcs.removePropertyChangeListener (l); 86 } 87 88 private void readObject (java.io.ObjectInputStream ois) 89 throws java.io.IOException , ClassNotFoundException { 90 ois.defaultReadObject (); 91 init (); 92 } 93 } 94 | Popular Tags |