Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How can i hide my browser?
How can i hide my browser? [message #703997] Thu, 28 July 2011 07:04 Go to next message
GloryKim  is currently offline GloryKim Friend
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 13:36 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2151
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 15:59 Go to previous messageGo to next message
Lakshmi ShanmugamFriend
Messages: 274
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
Re: How can i hide my browser? [message #708709 is a reply to message #708248] Wed, 03 August 2011 05:26 Go to previous message
GloryKim  is currently offline GloryKim Friend
Messages: 3
Registered: July 2011
Junior Member
thanks
Previous Topic:How to deselect a TableCursor?
Next Topic:Table Rendering problem in Windows 7
Goto Forum:
  


Current Time: Fri Nov 28 02:03:11 GMT 2014

Powered by FUDForum. Page generated in 0.02885 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software