aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes error regarding jdic Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "error regarding jdic" Watch "error regarding jdic" New topic
Author

error regarding jdic

Suzzane Pinto
Ranch Hand

Joined: Feb 10, 2012
Posts: 213
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jdic in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1030)
at org.jdesktop.jdic.browser.internal.WebBrowserUtil$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at org.jdesktop.jdic.browser.internal.WebBrowserUtil.loadLibrary(Unknown Source)
at org.jdesktop.jdic.browser.WebBrowser.<clinit>(Unknown Source)
at web.Browser1.jbInit(Browser1.java:173)
at web.Browser1.<init>(Browser1.java:69)
at web.Browser1.main(Browser1.java:85)
Java Result: 1
BUILD SUCCESSFUL (total time: 1 second)


i have included the jar still it is showing me the error.....
can anyone help....

email: [removed]
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4542
    
    5

Hello suzanne and welcome to the Ranch! Perhaps you haven't gone through How To Ask Questions On Java Ranch. The specific sections I would like to point you to are CarefullyChooseOneForum, TellTheDetails, UseOneThreadPerQuestion and UseTheForumNotEmail

This question has nothing at all to do with Swing / AWT / SWT / JFace. I'm moving it to a more appropriate section.
You need to tell us more about your code, and how you executed it.
The identical post you made in this thread has been removed.
Your email address has been removed from the post.

luck, db
There are no new questions, but there may be new answers.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

I believe that JDIC needs not only a jar, but some native code as well. I assume you're using a Windows computer, so that would be a DLL in your case. There might be more executable components, too, so check the documentation. I believe they should be put in the same directory as the jar.
Suzzane Pinto
Ranch Hand

Joined: Feb 10, 2012
Posts: 213
thank you paul,

the jdic lib error is solved now the problem is

1)i am unable to run the main project it says unable to launch the application...and den wen i try to run the main file the error shows as:

*** Jtrace: Msg Client new once!
*** Jtrace: Specified browserManager null
*** Jtrace: Default browserManager is used.
Exception in thread "EventThread" java.lang.NullPointerException
*** Jtrace: No browser is selected as active,you must specify one by setActiveEngine()!
at org.jdesktop.jdic.browser.internal.MsgClient.<init>(Unknown Source)
at org.jdesktop.jdic.browser.internal.NativeEventThread.run(Unknown Source)
BUILD SUCCESSFUL (total time: 8 seconds)

please help as i am a fresher and learning from scratch....
Suzzane Pinto
Ranch Hand

Joined: Feb 10, 2012
Posts: 213
hi,

i have added mozilla as a default browser now so the error which ocurred before disappeared.
still no link is called...
it says.........
*** Jtrace: Msg Client new once!
*** Jtrace: Specified browserManager null
*** Jtrace: Default browserManager is used.
*** Jtrace: Found a free socket port: 2034
native lib path D:\sumdhi\jars/jdic_native*** Jtrace: init share native.....
*** Jtrace: Got xpcom from registry(win)/path(unix)
native lib path D:\sumdhi\jars/jdic_native*** Jtrace: Executing D:\sumdhi\jars/jdic_native\MozEmbed.exe -port=2034
*** Jtrace: Connecting to native browser ... 0
*** Jtrace: connected
*** Jtrace: Process event to native browser: 0, 0,
*** Jtrace: Send data to socket: 0,0,</html><body></html>
*** Jtrace: Process event to native browser: 0, 1,
*** Jtrace: Read data from socket:
*** Jtrace: Native embedded browser died.
BUILD SUCCESSFUL (total time: 23 seconds)

why is it showing native embedded browser died???
helppppppp
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

JDIC used to support Mozilla (or vice versa) back in 2006 (?) when it was written. Now (if I understand right) it doesn't. I find that using IE as the browser seems to work fine.
Suzzane Pinto
Ranch Hand

Joined: Feb 10, 2012
Posts: 213
hi paul....

thanks for the last post.After setting IE as my default browser now i am to run my java browser.
now i am trying to create a tabbed browser.i am using openInNewBrowserPanel(null) which takes string; method of BrTabbed class to open a blank tab in my browser.
i am trying to implement some speed dialing kind of stuffs inside that by creating buttons....is it possible???
unable to call another frame inside the browser.Is there any way i can achieve this???
my code is:


package web;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ItemListener;
import java.awt.event.KeyEvent;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ButtonGroup;
import javax.swing.JOptionPane;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import org.jdic.web.BrXMLTree;
import org.jdic.web.event.BrComponentEvent;
import org.jdic.web.event.BrComponentListener;
import org.w3c.dom.Node;
import web.NewBrowser;


/**
* Sample browser implementation.
* @author uta
*/
public class BrowserFrame extends javax.swing.JFrame
implements BrComponentListener
{

/** Creates new form BrowserFrame */
public BrowserFrame() {
org.jdic.web.BrComponent.DESIGN_MODE = false;
initComponents();
brMain.addBrComponentListener(this);

ButtonGroup group = new ButtonGroup();

final UIManager.LookAndFeelInfo[] LFs = UIManager.getInstalledLookAndFeels();
for(int i = 0; i < LFs.length; i++) {
JRadioButtonMenuItem lfsMenuItem = (JRadioButtonMenuItem)viewJMenu.add(
new JRadioButtonMenuItem(LFs[i].getName()));
group.add(lfsMenuItem);
lfsMenuItem.setSelected(UIManager.getLookAndFeel().getName().equals(LFs[i].getName()));
lfsMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1 + i, ActionEvent.ALT_MASK));
lfsMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
JRadioButtonMenuItem rb = (JRadioButtonMenuItem) evt.getSource();
if(rb.isSelected() ){
for(int j = 0; j < LFs.length; j++) {
if (rb.getText().equals(LFs[j].getName())) {
try {
UIManager.setLookAndFeel(LFs[j].getClassName());
SwingUtilities.updateComponentTreeUI(BrowserFrame.this);
} catch (Exception ex) {
rb.setEnabled(false);
Logger.getLogger(BrowserFrame.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
}
}
});
}

}

// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

jPopupMenu1 = new javax.swing.JPopupMenu();
jPanel1 = new javax.swing.JPanel();
jPanel3 = new javax.swing.JPanel();
jSplitPane1 = new javax.swing.JSplitPane();
jPanel2 = new javax.swing.JPanel();
bnRefresh = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
brXMLTree = new org.jdic.web.BrXMLTree();
brMain = new org.jdic.web.BrTabbed();
ieToolBar = new javax.swing.JToolBar();
bnBack = new javax.swing.JButton();
b1 = new javax.swing.JButton("image1");
//b2 = new javax.swing.JButton("image2");
bnForward = new javax.swing.JButton();
bnReload = new javax.swing.JButton();
bnStop = new javax.swing.JButton();
lbURL = new javax.swing.JLabel();
edAddress = new javax.swing.JTextField();
bnGo = new javax.swing.JButton();
ieStatus = new javax.swing.JToolBar();
edStatusText = new javax.swing.JTextField();
bnLocker = new javax.swing.JButton();
pbDownloadDoc = new javax.swing.JProgressBar();
mainJMenuBar = new javax.swing.JMenuBar();
fileJMenu = new javax.swing.JMenu();
miNewTab = new javax.swing.JMenuItem();
miOpen = new javax.swing.JMenuItem();
miSave = new javax.swing.JMenuItem();
miPrint = new javax.swing.JMenuItem();
jSeparator1 = new javax.swing.JSeparator();
miExit = new javax.swing.JMenuItem();
viewJMenu = new javax.swing.JMenu();
toolsJMenu = new javax.swing.JMenu();
cmiTraceRedraw = new javax.swing.JCheckBoxMenuItem();
FlowLayout exp = new FlowLayout();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setIconImage(new javax.swing.ImageIcon(getClass().getResource("/web/images/Reload.PNG")).getImage());

org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, brMain, org.jdesktop.beansbinding.ELProperty.create("${windowTitle}"), this, org.jdesktop.beansbinding.BeanProperty.create("title"));
binding.setSourceNullValue("Simple Java Browser");
bindingGroup.addBinding(binding);

jPanel1.setLayout(new java.awt.BorderLayout());

jSplitPane1.setDividerLocation(300);
jSplitPane1.setResizeWeight(1.0);
jSplitPane1.setMinimumSize(new java.awt.Dimension(100, 100));

jPanel2.setPreferredSize(new java.awt.Dimension(0, 0));
jPanel2.setRequestFocusEnabled(false);

bnRefresh.setText("Create DOM view");
bnRefresh.setFocusable(false);
bnRefresh.setHorizontalAlignment(javax.swing.SwingConstants.LEADING);
bnRefresh.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
bnRefresh.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);

binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, brMain, org.jdesktop.beansbinding.ELProperty.create("${documentReady}"), bnRefresh, org.jdesktop.beansbinding.BeanProperty.create("enabled"));
bindingGroup.addBinding(binding);

bnRefresh.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bnRefreshActionPerformed(evt);
}
});

brXMLTree.addTreeWillExpandListener(new javax.swing.event.TreeWillExpandListener() {
public void treeWillExpand(javax.swing.event.TreeExpansionEvent evt)throws javax.swing.tree.ExpandVetoException {
brXMLTreeTreeWillExpand(evt);
}
public void treeWillCollapse(javax.swing.event.TreeExpansionEvent evt)throws javax.swing.tree.ExpandVetoException {
}
});
brXMLTree.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
public void valueChanged(javax.swing.event.TreeSelectionEvent evt) {
brXMLTreeValueChanged(evt);
}
});
jScrollPane1.setViewportView(brXMLTree);

javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(bnRefresh)
.addContainerGap(148, Short.MAX_VALUE))
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 267, Short.MAX_VALUE)
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(bnRefresh)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 474, Short.MAX_VALUE))
);

bnRefresh.getAccessibleContext().setAccessibleName("bnRefresh");

jSplitPane1.setRightComponent(jPanel2);

brMain.setURL("http://www.google.com");
brMain.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
public void propertyChange(java.beans.PropertyChangeEvent evt) {
brMainPropertyChange(evt);
}
});
jSplitPane1.setLeftComponent(brMain);

jPanel1.add(jSplitPane1, java.awt.BorderLayout.CENTER);

ieToolBar.setRollover(true);

bnBack.setIcon(new javax.swing.ImageIcon(getClass().getResource("/web/images/Back.PNG"))); // NOI18N
bnBack.setToolTipText("Go back one page");
bnBack.setFocusable(false);
bnBack.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
bnBack.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);

binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, brMain, org.jdesktop.beansbinding.ELProperty.create("${goBackEnable}"), bnBack, org.jdesktop.beansbinding.BeanProperty.create("enabled"));
bindingGroup.addBinding(binding);

bnBack.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bnBackActionPerformed(evt);
}
});
ieToolBar.add(bnBack);

bnForward.setIcon(new javax.swing.ImageIcon(getClass().getResource("/web/images/Forward.PNG"))); // NOI18N
bnForward.setToolTipText("Go forward one page");
bnForward.setFocusable(false);
bnForward.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
bnForward.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);

binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, brMain, org.jdesktop.beansbinding.ELProperty.create("${goForwardEnable}"), bnForward, org.jdesktop.beansbinding.BeanProperty.create("enabled"));
bindingGroup.addBinding(binding);

bnForward.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bnForwardActionPerformed(evt);
}
});
ieToolBar.add(bnForward);

bnReload.setIcon(new javax.swing.ImageIcon(getClass().getResource("/web/images/Reload.PNG"))); // NOI18N
bnReload.setToolTipText("Reload current page");
bnReload.setFocusable(false);
bnReload.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
bnReload.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
bnReload.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bnReloadActionPerformed(evt);
}
});
ieToolBar.add(bnReload);

bnStop.setIcon(new javax.swing.ImageIcon(getClass().getResource("/web/images/Stop.PNG"))); // NOI18N
bnStop.setToolTipText("Reload current page");
bnStop.setFocusable(false);
bnStop.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
bnStop.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
bnStop.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bnStopActionPerformed(evt);
}
});
ieToolBar.add(bnStop);

lbURL.setText(" URL:");
ieToolBar.add(lbURL);

edAddress.setText("http://");
edAddress.setToolTipText("URL for navigation");
edAddress.setPreferredSize(new java.awt.Dimension(400, 20));
edAddress.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
onNavigate(evt);
}
});
ieToolBar.add(edAddress);

bnGo.setText("Go");
bnGo.setToolTipText("Go to entered URL");
bnGo.setFocusable(false);
bnGo.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
bnGo.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
bnGo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
onNavigate(evt);
}
});
ieToolBar.add(bnGo);

jPanel1.add(ieToolBar, java.awt.BorderLayout.PAGE_START);

ieStatus.setFloatable(false);
ieStatus.setRollover(true);
ieStatus.setMaximumSize(new java.awt.Dimension(65536, 20));
ieStatus.setMinimumSize(new java.awt.Dimension(10, 20));

edStatusText.setEditable(false);
edStatusText.setMaximumSize(new java.awt.Dimension(2147483647, 20));

binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, brMain, org.jdesktop.beansbinding.ELProperty.create("${statusText}"), edStatusText, org.jdesktop.beansbinding.BeanProperty.create("text"));
bindingGroup.addBinding(binding);

edStatusText.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
edStatusTextActionPerformed(evt);
}
});
ieStatus.add(edStatusText);

bnLocker.setIcon(new javax.swing.ImageIcon(getClass().getResource("/web/images/locker.PNG"))); // NOI18N
bnLocker.setFocusable(false);
bnLocker.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
bnLocker.setMaximumSize(new java.awt.Dimension(20, 20));
bnLocker.setMinimumSize(new java.awt.Dimension(20, 20));
bnLocker.setPreferredSize(new java.awt.Dimension(20, 20));
bnLocker.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
bnLocker.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bnLockerActionPerformed(evt);
}
});
ieStatus.add(bnLocker);

pbDownloadDoc.setMaximumSize(new java.awt.Dimension(100, 16));
pbDownloadDoc.setPreferredSize(new java.awt.Dimension(100, 16));
ieStatus.add(pbDownloadDoc);

jPanel1.add(ieStatus, java.awt.BorderLayout.PAGE_END);

fileJMenu.setText("File");
fileJMenu.setToolTipText("File Operations");

miNewTab.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.CTRL_MASK));
miNewTab.setText("New Tab");
miNewTab.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
miNewTabActionPerformed(evt);
}
});
fileJMenu.add(miNewTab);

miOpen.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
miOpen.setIcon(new javax.swing.ImageIcon(getClass().getResource("/web/images/open.PNG"))); // NOI18N
miOpen.setText("Open File...");
miOpen.setToolTipText("Opens a document in this window");
miOpen.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
miOpenActionPerformed(evt);
}
});
fileJMenu.add(miOpen);

miSave.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
miSave.setText("Save Page As...");
miSave.setToolTipText("Saves this document as a file");
miSave.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
miSaveActionPerformed(evt);
}
});
fileJMenu.add(miSave);

miPrint.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.CTRL_MASK));
miPrint.setIcon(new javax.swing.ImageIcon(getClass().getResource("/web/images/print.PNG"))); // NOI18N
miPrint.setText("Print");
miPrint.setToolTipText("Prints this page");
miPrint.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
miPrintActionPerformed(evt);
}
});
fileJMenu.add(miPrint);
fileJMenu.add(jSeparator1);

miExit.setText("Exit");
miExit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
miExitActionPerformed(evt);
}
});
fileJMenu.add(miExit);

mainJMenuBar.add(fileJMenu);

viewJMenu.setText("View");
mainJMenuBar.add(viewJMenu);

toolsJMenu.setText("Tools");

binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, cmiTraceRedraw, org.jdesktop.beansbinding.ELProperty.create("${selected}"), toolsJMenu, org.jdesktop.beansbinding.BeanProperty.create("debugGraphicsOptions"));
bindingGroup.addBinding(binding);

cmiTraceRedraw.setText("Trace Redraw");
cmiTraceRedraw.setToolTipText("Shows update region while redraw procedure");
cmiTraceRedraw.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cmiTraceRedrawActionPerformed(evt);
}
});
toolsJMenu.add(cmiTraceRedraw);

mainJMenuBar.add(toolsJMenu);

setJMenuBar(mainJMenuBar);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 573, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 556, Short.MAX_VALUE)
);

bindingGroup.bind();

pack();
}// </editor-fold>//GEN-END:initComponents

private void edStatusTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_edStatusTextActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_edStatusTextActionPerformed

private void miSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miSaveActionPerformed
brMain.save();
}//GEN-LAST:event_miSaveActionPerformed

private void miExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miExitActionPerformed
dispose();
}//GEN-LAST:event_miExitActionPerformed

private void bnLockerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnLockerActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_bnLockerActionPerformed

private void onNavigate(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_onNavigate
brMain.setURL(edAddress.getText());
}//GEN-LAST:event_onNavigate

private void bnBackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnBackActionPerformed
brMain.back();
}//GEN-LAST:event_bnBackActionPerformed

private void bnForwardActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnForwardActionPerformed
brMain.forward();
}//GEN-LAST:event_bnForwardActionPerformed

private void bnReloadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnReloadActionPerformed
brMain.refresh();
}//GEN-LAST:event_bnReloadActionPerformed

private void bnStopActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnStopActionPerformed
brMain.stop();
}//GEN-LAST:event_bnStopActionPerformed

private void miPrintActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miPrintActionPerformed
brMain.print();
}//GEN-LAST:event_miPrintActionPerformed

private void miOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miOpenActionPerformed
brMain.open();
}//GEN-LAST:event_miOpenActionPerformed

private void cmiTraceRedrawActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmiTraceRedrawActionPerformed
brMain.setDebugDrawBorder(cmiTraceRedraw.isSelected());
}//GEN-LAST:event_cmiTraceRedrawActionPerformed

private Rectangle rcOldSelect = null;
static final String stGetElemByPath =
"function __gn(stPath)\n" +
"{\n" +
" var childOrder = stPath.split(\"/\");\n" +
" htmlNode = document;\n" +
" for(var i = 0; null!=htmlNode && i<childOrder.length; ++i) {\n" +
" var index = 0;\n" +
" var limit = parseInt(childOrder[i]);\n" +
" for(\n" +
" var htmlNode = htmlNode.firstChild;\n" +
" null!=htmlNode && index < limit;\n" +
" htmlNode = htmlNode.nextSibling )\n" +
//ditry HTML
" if( -1==htmlNode.nodeName.indexOf(\'/\') &&\n" +
" -1==htmlNode.nodeName.indexOf('<') &&\n" +
" -1==htmlNode.nodeName.indexOf('!') &&\n" +
" -1==htmlNode.nodeName.indexOf('?') &&\n" +
" -1==htmlNode.nodeName.indexOf('>')) " +
" {\n" +
" ++index;\n" +
" }\n" +
" }\n" +
" return htmlNode;\n" +
"}\n";

private String stOldParams = "";
private void brXMLTreeValueChanged(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_brXMLTreeValueChanged
if(
null==evt ||
null==evt.getNewLeadSelectionPath() ||
null==evt.getNewLeadSelectionPath().getLastPathComponent() )
{
return;
}
String pathNew = BrXMLTree.getNodePath(
(Node)(evt.getNewLeadSelectionPath().getLastPathComponent()) );
String pathOld = (null==evt.getOldLeadSelectionPath())
? ""
: BrXMLTree.getNodePath( (Node)(evt.getOldLeadSelectionPath().getLastPathComponent()) );

if(null!=rcOldSelect){
brMain.repaint(rcOldSelect);
}
final String stCommand = "#" + stGetElemByPath +
"var res = \"\";\n" +
( pathOld.isEmpty() ? "" :
"var elOld = __gn(\"" + pathOld + "\");\n" +
"if(null != elOld) {\n" +
" var cs = elOld.runtimeStyle;\n" +
" if( null != cs ) {\n" +
" var prs = \"" + stOldParams + "\".split(\",\");\n" +
" cs.borderStyle = prs[0];\n" +
" cs.borderWidth = prs[1];\n" +
" cs.borderColor = prs[2];\n" +
" }\n " +
"}\n") +
"var elNew = __gn(\"" + pathNew + "\");\n" +
"if(null != elNew) {\n" +
" var cs = elNew.runtimeStyle;\n" +
" if( null != cs ) {\n" +
" elNew.scrollIntoView();\n" +
" res = cs.borderStyle + \",\" +" +
" cs.borderWidth + \",\" +" +
" cs.borderColor\n" +
" cs.borderStyle = \"dashed\";\n" +
" cs.borderWidth = \"5px\";\n" +
" cs.borderColor = \"#FF0000\";\n" +
" }\n " +
"}\n" +
"document.documentElement.setAttribute(\"javaEval\", res);\n";
stOldParams = brMain.execJS(stCommand);
//stOldColor = stOldColor.substring(0, stOldColor.length()-1);
}//GEN-LAST:event_brXMLTreeValueChanged

private void brXMLTreeTreeWillExpand(javax.swing.event.TreeExpansionEvent evt)throws javax.swing.tree.ExpandVetoException {//GEN-FIRST:event_brXMLTreeTreeWillExpand
}//GEN-LAST:event_brXMLTreeTreeWillExpand

private void bnRefreshActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnRefreshActionPerformed
brXMLTree.setXMLSource(brMain.getXHTML());
}//GEN-LAST:event_bnRefreshActionPerformed

private void brMainPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_brMainPropertyChange
String stPN = evt.getPropertyName();
if(stPN.equals("securityIcon")
|| stPN.equals("navigatedURL")
|| stPN.equals("progressBar")
){
String stNV = (String)evt.getNewValue();
if(null==stNV)
stNV = "";
String st[] = stNV.split(",");
if(stPN.equals("navigatedURL")) {
edAddress.setText( st[0] );
stOldParams = "";
brXMLTree.empty();
} else if(stPN.equals("progressBar")) {
int iMax = Integer.parseInt(st[0]),
iPos = Integer.parseInt(st[1]);
if(0==iMax){
pbDownloadDoc.setVisible(false);
if(brMain.isDocumentReady()){
//bnRefreshActionPerformed(null);
}
} else {
pbDownloadDoc.setMaximum(iMax);
pbDownloadDoc.setValue(iPos);
pbDownloadDoc.setVisible(true);
}
} else if(stPN.equals("securityIcon")) {
bnLocker.setVisible(!stNV.equals("0"));
}
}
}//GEN-LAST:event_brMainPropertyChange

public void miNewTabActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miNewTabActionPerformed




brMain.openInNewBrowserPanel(null);
//open();
//jPanel1.add(b1);




}//GEN-LAST:event_miNewTabActionPerformed

/* public void open(){
new NewBrowser();
}*/

/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new BrowserFrame().setVisible(true);
}
});
}

// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton bnBack,b1;
private javax.swing.JButton bnForward;
private javax.swing.JButton bnGo;
private javax.swing.JButton bnLocker;
private javax.swing.JButton bnRefresh;
private javax.swing.JButton bnReload;
private javax.swing.JButton bnStop;
private org.jdic.web.BrTabbed brMain;
private org.jdic.web.BrXMLTree brXMLTree;
private javax.swing.JCheckBoxMenuItem cmiTraceRedraw;
private javax.swing.JTextField edAddress;
private javax.swing.JTextField edStatusText;
private javax.swing.JMenu fileJMenu;
private javax.swing.JToolBar ieStatus;
private javax.swing.JToolBar ieToolBar;
private javax.swing.JPanel jPanel1, jPanel3;
private javax.swing.JPanel jPanel2;
private javax.swing.JPopupMenu jPopupMenu1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSplitPane jSplitPane1;
private javax.swing.JLabel lbURL;
private javax.swing.JMenuBar mainJMenuBar;
private javax.swing.JMenuItem miExit;
private javax.swing.JMenuItem miNewTab;
private javax.swing.JMenuItem miOpen;
private javax.swing.JMenuItem miPrint;
private javax.swing.JMenuItem miSave;
private javax.swing.JProgressBar pbDownloadDoc;
private javax.swing.JMenu toolsJMenu;
private javax.swing.JMenu viewJMenu;
private org.jdesktop.beansbinding.BindingGroup bindingGroup;
// End of variables declaration//GEN-END:variables

public void onClosingWindowByScript(boolean isChildWindow){
if(!isChildWindow && JOptionPane.YES_OPTION==JOptionPane.showConfirmDialog(
this,
"The webpage you are viewing is trying to close the window.\n" +
"Do you want to close this window?",
"Warning",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE))
{
brMain.closeCurrentPage();
}
}

public String sync(BrComponentEvent e) {
switch(e.getID()){
case BrComponentEvent.DISPID_WINDOWCLOSING:
String stValue = e.getValue();
if(null!=stValue){
//OLE boolean: -1 - true, 0 - false; paramsbCancel, bIsChildWindow)
final boolean isChildWindow = (0!=Integer.valueOf(stValue.split(",")[1]));
javax.swing.SwingUtilities.invokeLater ( new Runnable() {
public void run() {
onClosingWindowByScript(isChildWindow);
}
});
}
break;
}
return null;
}

}
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

suzzane selvaraj wrote:Is there any way i can achieve this???


There might be. I didn't look at your code, and I doubt anybody else will either. That's because it's (a) unformatted and (b) far too long.

It would help if you used the code tags to format your code. (When you post there's a "Code" button above the box you're posting in. Use it.) It would also help if you posted an SSCCE (follow that link and read it) instead of just dumping your entire program and hoping people can wade through it to find the relevant bits.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41819
    
  62
While I don't have any insight into this particular problem, I'd like to point out that JDIC has last seen development several years ago. Some parts of it have found their way into Java 6 and 7, but everything else I'd consider obsolete; certainly unsupported and thus liable to break in new JVMs, browsers, OSes etc. I'd urge to consider alternatives before investing significantly into JDIC.


Ping & DNS - my free Android networking tools app
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

I am painfully aware of that. I have a Swing application which I use at home, and at some point a few years ago I needed to add the ability to select locations from a map and find the latitude and longitude of those locations.

So the obvious thing was to start a browser, load Google Maps and a bit of helpful Javascript, and have the application interface with this browser to get the latitude and longitude on request. Even at the time I did that programming, JDIC was essentially dead, but after a bit of hacking I got it to work.

At the time I looked at Swing components which would act like a browser, but nothing I saw looked like it would work with Javascript and Google Maps. Delegating to a real browser seemed like the way to go, so JDIC was it. But with the risks you mentioned.

There are a few ways for me to get out of that trap:

  • Convert the application to an applet and try to make it work with Javascript
  • Rewrite the application as a web app which uses Google Maps
  • Redo the search for a suitable Swing component


  • Do you have any suggestions for other alternatives? Or recommendations about those three alternatives?
    Paul Clapham
    Bartender

    Joined: Oct 14, 2005
    Posts: 18570
        
        8

    Then I googled for swing browser components. There were a lot which didn't exist any more, or which used things which didn't work any more. There was a promising candidate, but the owners wanted 980 euros for it. That wasn't in my budget for my little home project. Finally I came to The DJ Project. It's free, it comes with sample code and a demo, it seems faster and more reliable than JDIC. It's been about two hours since I downloaded it, and working from the sample code I have pretty much finished the replacement for my Swing component which uses JDIC.
    Ulf Dittmer
    Marshal

    Joined: Mar 22, 2005
    Posts: 41819
        
      62
    Good find! I'll have to check that out. My standard bearer would have been Lobo/Cobra (on SourceForge), but that's dormant as well.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: error regarding jdic