import java.awt.event.WindowEvent;
import javax.swing.*;
import javax.swing.border.*;
import org.lobobrowser.gui.*;
import org.lobobrowser.main.PlatformInit;
public class BrowserPanelTest extends JFrame {
public static void main(String[] args) throws Exception {
PlatformInit.getInstance().initLogging(false);
PlatformInit.getInstance().init(false, false);
// Create frame with a specific size.
JFrame frame = new BrowserPanelTest();
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.setSize(600, 400);
frame.setVisible(true);
}
public BrowserPanelTest() throws Exception {
this.setTitle("Lobo Demo");
final BrowserPanel bp = new BrowserPanel();
bp.setBorder(BorderFactory.createTitledBorder(new EtchedBorder(EtchedBorder.RAISED), "Embedded browser"));
bp.navigate("http://lobobrowser.org/browser/home.jsp");
this.getContentPane().add(bp);
this.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(WindowEvent e) {
// This needs to be called in order
// to inform extensions about the
// window closing.
bp.windowClosing();
}
});
}
}
我打算创建一个启用了CSS和JavaScript的Web浏览器。我下载了Lobo Browser,将jar文件添加到我项目的类路径中,然后访问了他们的网站以了解如何使用它。我得到了一个例子在那里测试它。但是,我遇到了一堆错误信息,例如: -
Oct 24, 2014 9:33:08 PM org.lobobrowser.primary.ext.ExtensionImpl showError
WARNING: showError(): An error occurred trying to process document http://lobobrowser.org/browser/home.jsp
java.lang.IncompatibleClassChangeError: Found interface sun.font.FontManager, but class was expected
at org.lobobrowser.util.gui.FontFactory.createFont(FontFactory.java:210)
at org.lobobrowser.util.gui.FontFactory.createFont_Impl(FontFactory.java:180)
at org.lobobrowser.util.gui.FontFactory.createFont(FontFactory.java:127)
at org.lobobrowser.util.gui.FontFactory.getFont(FontFactory.java:98)
at org.lobobrowser.html.style.StyleSheetRenderState.<clinit>(StyleSheetRenderState.java:43)
at org.lobobrowser.html.domimpl.NodeImpl.<clinit>(NodeImpl.java:39)
at org.lobobrowser.html.parser.DocumentBuilderImpl.createDocument(DocumentBuilderImpl.java:143)
at org.lobobrowser.primary.clientlets.html.HtmlClientlet.processImpl(HtmlClientlet.java:150)
at org.lobobrowser.primary.clientlets.html.HtmlClientlet.process(HtmlClientlet.java:79)
at org.lobobrowser.request.ClientletRequestHandler.processResponse(ClientletRequestHandler.java:115)
at org.lobobrowser.request.RequestEngine.processHandler(RequestEngine.java:856)
at org.lobobrowser.request.RequestEngine.access$1(RequestEngine.java:713)
at org.lobobrowser.request.RequestEngine$RequestHandlerTask$1.run(RequestEngine.java:1026)
at java.security.AccessController.doPrivileged(Native Method)
at org.lobobrowser.request.RequestEngine$RequestHandlerTask.run(RequestEngine.java:1033)
at org.lobobrowser.util.SimpleThreadPool$ThreadRunnable.run(SimpleThreadPool.java:127)
at java.lang.Thread.run(Thread.java:722)
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: Could not initialize class org.lobobrowser.html.domimpl.HTMLDocumentImpl
at org.lobobrowser.html.parser.DocumentBuilderImpl.createDocument(DocumentBuilderImpl.java:143)
at org.lobobrowser.html.parser.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:97)
at org.lobobrowser.html.gui.HtmlPanel.setHtml(HtmlPanel.java:414)
at org.lobobrowser.primary.ext.ExtensionImpl.getErrorComponent(ExtensionImpl.java:95)
at org.lobobrowser.primary.ext.ExtensionImpl.showError(ExtensionImpl.java:87)
at org.lobobrowser.primary.ext.ExtensionImpl$1.errorOcurred(ExtensionImpl.java:49)
at org.lobobrowser.main.Extension$NavigatorErrorEventDispatch.dispatchEvent(Extension.java:532)
at org.lobobrowser.util.EventDispatch2.fireEvent(EventDispatch2.java:71)
at org.lobobrowser.main.Extension.handleError(Extension.java:318)
at org.lobobrowser.main.ExtensionManager$3.run(ExtensionManager.java:304)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:705)
at java.awt.EventQueue.access$000(EventQueue.java:101)
at java.awt.EventQueue$3.run(EventQueue.java:666)
at java.awt.EventQueue$3.run(EventQueue.java:664)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:675)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Oct 24, 2014 9:33:23 PM org.lobobrowser.store.CacheManager run
SEVERE: run()
java.lang.NullPointerException
at org.lobobrowser.store.CacheManager.populateCacheStoreInfo(CacheManager.java:283)
at org.lobobrowser.store.CacheManager.getCacheStoreInfo(CacheManager.java:277)
at org.lobobrowser.store.CacheManager.sweepCache(CacheManager.java:237)
at org.lobobrowser.store.CacheManager.run(CacheManager.java:219)
at java.lang.Thread.run(Thread.java:722)
enybody能让我离开黑水的大锅吗?