Is it possible to hide the right scroll-bar of the IE?
I wrote following sample to get a fullscreen browser:
import com.jniwrapper.win32.ie.Browser;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import java.awt.BorderLayout;
import java.awt.GraphicsEnvironment;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class FullscreenSample
{
private static final String HTML_CONTENT = "<html><body><h1>FullscreenSample</h1>Use the above textfield for your url.</body></html>";
public static void main(String[] args) throws Exception
{
JFrame frame = new JFrame("JExplorer - FullscreenSample");
// hide borders etc.
frame.setUndecorated(true);
// adjust frame to the default device
frame.setBounds(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().getBounds());
final Browser browser = new Browser();
// add a JPanel with the browser and a textfield for URL
JPanel panel = new JPanel(new BorderLayout());
panel.add(browser);
final JTextField textfield = new JTextField();
textfield.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
browser.navigate(textfield.getText());
}
});
panel.add(BorderLayout.NORTH, textfield);
panel.add(BorderLayout.CENTER, browser);
frame.getContentPane().add(panel);
frame.setVisible(true);
// Wait when the browser will be ready to work
browser.waitReady();
browser.setContent(HTML_CONTENT);
browser.waitReady();
}
}
Hi Frankmartin,
Yes, it is possible. For this you just need to modify the appropriate property of a Browser object, for example:
Browser browser = new Browser();
browser.getProperties().setShowScrollBars(false);
-Serge
Hi Serge,
thankyou, but I couldn't place the
browser.getProperties().setShowScrollBars(false);at the beginning. In this case I got
com.jniwrapper.win32.com.ComException: com.jniwrapper.win32.com.ComException: COM object method returns error code: 0x80004005; E_FAIL
But following code works:
....
public static void main(String[] args) throws Exception
{
JFrame frame = new JFrame("JExplorer - FullscreenSample");
frame.setUndecorated(true);
frame.setBounds(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().getBounds());
final Browser browser = new Browser();
// browser.getProperties().setShowScrollBars(false); // why an exception here?
// add a JPanel with the browser and a textfield for URL
JPanel panel = new JPanel(new BorderLayout());
panel.add(browser);
final JTextField textfield = new JTextField();
textfield.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
browser.navigate(textfield.getText());
browser.waitReady();
}
});
panel.add(BorderLayout.NORTH, textfield);
panel.add(BorderLayout.CENTER, browser);
frame.getContentPane().add(panel);
frame.setVisible(true);
// Wait when the browser will be ready to work
browser.waitReady();
browser.getProperties().setShowScrollBars(false);
browser.setContent(HTML_CONTENT);
browser.waitReady();
}
}
... now I will see how it works in my real-life application ...
Frankmartin
Hello Frankmartin,
I run your sample with the latest build of JExplorer and I didn't see any exceptions. Please try to use the latest build of JExplorer that you can download from our ftp: ftp://ftp.jniwrapper.com/updates/jexplorer-1.8.699.zip
Please try it and let us know the results.
Regards,
Vladimir
Hello Vladimir,
with Version 1.8.699 the call setShowScrollBars works direct after the Constructor of Browser (the Exception is with 1.7):
...
JFrame frame = new JFrame("JExplorer - FullscreenSample");
frame.setUndecorated(true);
frame.setBounds(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().getBounds());
final Browser browser = new Browser();
browser.getProperties().setShowScrollBars(false);
Frankmartin
Hi Vladimir,
unfortunately the above described problem is back with final version 1.8 build 709.
Here the stacktrace:
D:\java\jexplorer\jexplorer-1.8\problem>java -classpath ./lib/jniwrap-3.6.1.jar;./lib/winpack-3.6.jar;./lib/comfyj-2.4.jar;./lib/jexplorer-1.8.jar;;./
classes; core.FullscreenSample
Exception in thread "main" com.jniwrapper.win32.com.ComException: com.jniwrapper.win32.com.ComException: COM object method returns error code: 0x80004
005; E_FAIL (Unbekannter Fehler)
at com.jniwrapper.win32.com.ComException.createComException(SourceFile:80)
at com.jniwrapper.win32.automation.e.invoke(SourceFile:265)
at $Proxy0.refresh(Unknown Source)
at com.jniwrapper.win32.ie.BrowserSupport.refresh(SourceFile:228)
at com.jniwrapper.win32.ie.M.propertyChange(SourceFile:1432)
at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)
at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)
at com.jniwrapper.win32.ie.WebBrowser$Properties.a(SourceFile:483)
at com.jniwrapper.win32.ie.WebBrowser$Properties.setShowScrollBars(SourceFile:560)
at core.FullscreenSample.main(FullscreenSample.java:23)
Caused by: com.jniwrapper.win32.com.ComException: COM object method returns error code: 0x80004005; E_FAIL (Unbekannter Fehler)
at com.jniwrapper.win32.com.impl.IUnknownImpl.invokeStandardVirtualMethod(SourceFile:681)
at com.jniwrapper.win32.shdocvw.impl.IWebBrowserImpl.refresh(SourceFile:110)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.jniwrapper.win32.automation.n.run(SourceFile:247)
at com.jniwrapper.win32.MessageLoopThread$ThreadSynchronizedAction.run(MessageLoopThread.java:569)
at com.jniwrapper.win32.MessageLoopThread$LoopThread.run(MessageLoopThread.java:511)
It worked with Version 1.8.685 and 1.8.699.
Further more the workaround to put setShowScrollBars(false) after browser.waitReady() does not work any more: the browser hangs.
The same problem with SetBrowserContentSample.
Regards,
Frankmartin
Hello Frankmartin,
Thank you for reporting this issue. We have updated release version of JExplorer. The reason of this issue it is a wrong version of JNIWrapper library in JExplorer pack. But we have fixed it. So, please try to download the latest version of JExplorer again from our site: http://teamdev.com/downloads/jexplorer/jexplorer-1.8.zip
Sorry for the inconvenience.
Regards,
Vladimir
thanks,
promptly resolved with jniwrap-3.6.1 build 667, 273.684 bytes.
Regards,
Frankmartin