Community
Participate
Working Groups
Build Identifier: SWT 3.7 the issue only happends when using the JVM version 7(1.7.0) using JVM 6(1.6.0_25) works fine. (so Far I have seen this issue on Windows 7 with IE8 browser) I have a Jframe Swing component, and i add a SWT_AWT component into a AWT canvas (a shell that contains a browser object) now this frame has others components such as panels buttons, text areas and so on... now the problem is when i use the web browser and type something into the webbrowser and then I try to focus the External(Swing) component the Keyboard focus remains on the Webbrowser(note the Swing component triggers a Focus Gain event and A carret is show) and does not allow me to type anything on the Swings components Unless I extract the focus to a diferent window that the affected application also i have experince the issue on the DJ native project that also add SWT components into Swing. http://djproject.sourceforge.net/ns/ Reproducible: Always Steps to Reproduce: 1.create a SWT_AWT shell with a webbrowser(IE8/win 7 in the cases i have tested so far) 2.navigate to any textfield and set keyboard focus 3.try to set focus on a Swing component outside the webrowser
Created attachment 200764 [details] a snippet that add a browser into Swing Jframe and the issue can be reproduced on the attached I have a Source of an application using SWT witha JVM version 7 the issue can be reproduced. as this example try to access google. type something on the google text area, and try to go back to the JtextArea it will not allow to type.
Any Update On this issue?
We noticed The Swing Components regains focus if we show a Dialog(such a JOptionPane) then close it also if the browser is on a TabPanel inside a JTabbedPane Component and we create a new tab it also returns the focus back to swing. however removing Tabs will not provide the same effect... unless of course the tab where the browser is located is closed. another aspect that we are able to return focus back to swing is removing focus completely from the java application and select another application then select the application back, when the OS provides focus is provided to the Swing Application and SWT release it.
I too had bug reports about this incompatibility with Java 7. I found a hack to allow Swing to regain focus: - I attach a global AWT listner. - On mouse pressed or focus gain, I disable and re-enable all embedded shells. -> this forces the native components to release focus. It solves most cases though it is easy to have a visual incoherence in the form of 2 carets: one in the Browser (the focused component), and one in Swing's text field which thinks it has the focus. This is a hack and I hope it is a temporary solution to this problem... One thing to consider is that there was significant work from the AWT team to improve lightweight/heavyweight components mixing, and they may have broken something. Maybe the SWT developers could confirm whether the bug is theirs or if it should be transfered to the AWT developers.
I'm having this same problem with LWJGL. Create a canvas parent it to LWJGL's OpenGL renderer. After clicking in the canvas, it starts grabbing keyboard input, and never releases. I try to focus any swing component eg. textbox, and can not type. Hotkeys also don't work.
I have the same issue, but I can't resolve it by disabling the AWT components and then reenabling them. I have no clue on where to search to find a workaround any more. Does the AWT/Swing team knows about this? Any update on this one?
I have the same issue while developing Eclipse plugin with Swing componenets, try to use the below code to fix it: IWorkbench workbench = PlatformUI.getWorkbench(); if (workbench != null) { IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); if (window != null) { IWorkbenchPage page = window.getActivePage(); if (page != null) { try { page.showView("yourViewID..."); } catch (PartInitException e) { e.printStackTrace(); } } } }
Hi, We integrate Flash in our Swing application (E-anim, free software) and these focus issues render our program unusable. Thus, this is a particularily critical issue for us. Feel free to contact me/us if you need any information about our Flash integration Philippe Destrumel
With 4.3.1 (but not 3.7) I am getting an NPE at the same location. I have a PartListener2Adapter with a partClosed method that tries to reopen the editor that is being closed. (I.e. open a new editor with new but equal editor input). Workaround is to use Display.asyncExec.
Ignore my previous comment, that was about another ticket! With Java 7 I'm also seeing a focus issue with the SWT_AWT bridge. (I'm not sure if it's the same but it sounds similar.) I embed Swing components in a Composite through Albireo's SwingControl which is based on the SWT_AWT bridge. When the composite does not have focus and I click somewhere inside the Swing component, the Composite does not gain focus. For me this introduces serious bugs. I am using the Composite inside an Eclipse View which provides selection to the workbench, but this selection does not become the active selection because of this focus issue.
Perhaps it's better to say that the workbench part containing the SwingControl is not activated by clicking somewhere inside the SwingControl. I'm not sure how this exactly works with focus gained events.
What I am experiencing was already reported as https://bugs.eclipse.org/bugs/show_bug.cgi?id=377104 May be related to this bug, my apologies if it is not.
I know that the post is old... but also with newer version it doesn't work java version "1.8.0_102" Java(TM) SE Runtime Environment (build 1.8.0_102-b14) Java HotSpot(TM) Client VM (build 25.102-b14, mixed mode, sharing) <dependency> <groupId>org.eclipse.swt</groupId> <artifactId>org.eclipse.swt.win32.win32.x86</artifactId> <version>4.3</version> </dependency>
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.