Skip to main content

jdic browser + netbeans gui designer: problem embedding browser

5 replies [Last post]
kracker43
Offline
Joined: 2008-02-19
Points: 0

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.net.URL;
import java.net.MalformedURLException;
import org.jdesktop.jdic.browser.*;

public class webrowser extends javax.swing.JFrame {

public webrowser() {
initComponents();
webBrowser = new WebBrowser();
try {
webBrowser.setURL(new URL("http://java.net"));
} catch (MalformedURLException e) {
System.out.println(e.getMessage());
return;
}
jPanel1.add(webBrowser);
this.getContentPane().add(jPanel1);
}

//
private void initComponents() {

jPanel1 = new javax.swing.JPanel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jPanel1.setBackground(new java.awt.Color(0, 204, 204));
jPanel1.setComponentPopupMenu(jPanel1.getComponentPopupMenu());
jPanel1.setInheritsPopupMenu(true);

javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 380, Short.MAX_VALUE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 278, Short.MAX_VALUE)
);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);

pack();
}//

public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new webrowser().setVisible(true);
}
});
}

// Variables declaration - do not modify
public javax.swing.JPanel jPanel1;
// End of variables declaration
public WebBrowser webBrowser;
}

any ideas? thx for your help!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
madroadie
Offline
Joined: 2006-04-20
Points: 0

Please place this in your frame class

static
{
BrowserEngineManager engineManager = BrowserEngineManager.instance();
engineManager.setActiveEngine(BrowserEngineManager.IE);
}

next time please send your error messages, where not going to build your example.

kracker43
Offline
Joined: 2008-02-19
Points: 0

i don't have this library in my package...i noticed in the web-java docs this class but in my package's docs i can't find it...has it been deleted?i noticed that all the packages i download don't have that library....
thx for the support!

madroadie
Offline
Joined: 2006-04-20
Points: 0

Searching jar file jdic.jar
org/jdesktop/jdic/browser/BrowserEngineManager.class

kracker43
Offline
Joined: 2008-02-19
Points: 0

well i discovered that
- jdic 0.9.3 works with the SimpleExample contained in jdic browser docs but doesn't contain BrowserEngineManager.class and a lot of other libraries
-jdic alphabuilds 20060613 has BrowserEngineManager.class but when i execute SimpleExample returns an error:
"Exception in Threads "EventThread" in java.NullPointerException"
org.jdesktop.jdic.browser.internal.MsgClient.
org.jdesktop.jdic.browser.internal.NativeEventThread.run
what's the problem?
bugs in the releases?

20mithrandir
Offline
Joined: 2006-10-25
Points: 0

So is there any chance to get a statemet why the BrowserEngineManager has ben eliminated and how to configure the engine programmatically with actual releases of JDIC?