| How can i hide my browser? [message #703997] |
Thu, 28 July 2011 03:04  |
GloryKim Messages: 3 Registered: July 2011 |
Junior Member |
|
|
Dear All
i make my browser using SWT.browser.
i like to hide my browser(invisible backgroud) but i dont know how to do?
------
shell = new Shell(display, SWT.NONE);
shell.setLayout(new FillLayout());
shell.setSize(1024, 768);
shell.setVisible(false); // not work
shell.setLocation(10, 20);
browser = new Browser(shell, SWT.NONE);
browser.setJavascriptEnabled(true);
browser.setVisible(false); // not work
------
thanks
|
|
|
| (no subject) [message #704309 is a reply to message #703997] |
Thu, 28 July 2011 09:36   |
Grant Gayed Messages: 2128 Registered: July 2009 |
Senior Member |
|
|
Browser.setVisible() should work for you:
public static void main(String args[]) {
Display display = new Display();
final Shell shell = new Shell(display);
shell.setLayout(new GridLayout());
Button button = new Button(shell, SWT.PUSH);
button.setText("Push");
final Browser browser = new Browser(shell, SWT.NONE);
browser.setLayoutData(new GridData(300,300));
browser.setUrl("eclipse.org");
button.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
browser.setVisible(!browser.getVisible());
}
});
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
Grant
On 7/28/2011 3:04 AM, GloryKim wrote:
> Dear All
>
> i make my browser using SWT.browser.
> i like to hide my browser(invisible backgroud) but i dont know how to do?
> ------
> shell = new Shell(display, SWT.NONE);
> shell.setLayout(new FillLayout());
> shell.setSize(1024, 768);
> shell.setVisible(false); // not work
> shell.setLocation(10, 20);
> browser = new Browser(shell, SWT.NONE);
> browser.setJavascriptEnabled(true);
> browser.setVisible(false); // not work
> ------
>
> thanks
|
|
|
| Re: How can i hide my browser? [message #708248 is a reply to message #703997] |
Tue, 02 August 2011 11:59   |
 |
Lakshmi Shanmugam Messages: 271 Registered: July 2009 Location: India |
Senior Member |
|
|
Hi,
Browser.setVisible(false) will hide the browser. It works for me on Windows Xp & Mac OSX. Which platform and SWT version are you using?
Shell.setVisible(false) also works fine. If you have a shell.open() after it then it would make the shell visible.
Lakshmi P Shanmugam
|
|
|
|
Powered by
FUDForum. Page generated in 0.03807 seconds