Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to activate HW button on Browser
How to activate HW button on Browser [message #460241] Tue, 23 August 2005 05:19 Go to next message
Eclipse UserFriend
Hello,
I am novice about the SWT-Browser, so this my question can be trivial.
But if anybody know how to solve this my problem, please let me know that.

My question is like below.
I want to activate HW button on Browser, but it seems not.
Below thing is the source code. ( SWT version - 3138 on windows)
The step to do is
1) Executes HWButtonBrowser.
2) Click any point on the Browser window
3) Press any keyboard button
In this case, any thing doesn't print on the console.

import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.browser.*;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
public class HWButtonBrowser {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("PRBrowser");
shell.setLayout(new FillLayout());
shell.addKeyListener(new KeyListener() {
public void keyPressed(KeyEvent arg0) {
System.out.println("keyPressed : " + arg0.toString());
}
public void keyReleased(KeyEvent arg0) {
System.out.println("keyReleased : " + arg0.toString());
}
});

Browser browser = new Browser(shell, SWT.NONE);
browser.setUrl("http://www.eclipse.org");

shell.open();

while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
}
}
Re: How to activate HW button on Browser [message #460267 is a reply to message #460241] Tue, 23 August 2005 10:39 Go to previous message
Eclipse UserFriend
You should hook your key listener on the Browser, not on the Shell.

Grant

"WooChul Jung" <wcjung@kr.ibm.com> wrote in message
news:fef7b9c79dee699199b2895efc6755fa$1@www.eclipse.org...
> Hello,
> I am novice about the SWT-Browser, so this my question can be trivial.
> But if anybody know how to solve this my problem, please let me know that.
>
> My question is like below.
> I want to activate HW button on Browser, but it seems not.
> Below thing is the source code. ( SWT version - 3138 on windows)
> The step to do is
> 1) Executes HWButtonBrowser.
> 2) Click any point on the Browser window
> 3) Press any keyboard button
> In this case, any thing doesn't print on the console.
>
> import org.eclipse.swt.*;
> import org.eclipse.swt.widgets.*;
> import org.eclipse.swt.layout.*;
> import org.eclipse.swt.browser.*;
> import org.eclipse.swt.events.FocusEvent;
> import org.eclipse.swt.events.FocusListener;
> import org.eclipse.swt.events.KeyEvent;
> import org.eclipse.swt.events.KeyListener;
> import org.eclipse.swt.events.MouseEvent;
> import org.eclipse.swt.events.MouseListener;
> public class HWButtonBrowser {
> public static void main(String[] args) {
> Display display = new Display();
> Shell shell = new Shell(display);
> shell.setText("PRBrowser");
> shell.setLayout(new FillLayout());
> shell.addKeyListener(new KeyListener() {
> public void keyPressed(KeyEvent arg0) {
> System.out.println("keyPressed : " + arg0.toString());
> }
> public void keyReleased(KeyEvent arg0) {
> System.out.println("keyReleased : " + arg0.toString());
> }
> });
>
> Browser browser = new Browser(shell, SWT.NONE);
> browser.setUrl("http://www.eclipse.org");
>
> shell.open();
>
> while (!shell.isDisposed()) {
> if (!display.readAndDispatch())
> display.sleep();
> }
> }
> }
>
Previous Topic:Escaping characters in FormText
Next Topic:syncExec Question
Goto Forum:
  


Current Time: Mon Jul 07 10:34:39 EDT 2025

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

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

Back to the top