This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 30274

Summary: Focus is lost after creating java class using wizard
Product: platform Reporter: pfelenda <pfelenda>
Component: Window SystemAssignee: mslama <mslama>
Status: VERIFIED FIXED    
Severity: blocker CC: jbecicka, jskrivanek, mmirilovic, mslama, pzavadsky
Priority: P2 Keywords: A11Y, FOCUS, T9Y
Version: 3.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: Log where focus event is created
Diff of suggested fix

Description pfelenda 2003-01-22 16:27:36 UTC
How to reproduce:
1 case :
Try create some files from explorer.
-> Sometimes file is opened in editor but without
focus (focus has another file)

2 case : 
If new file has focus in editor try click to
another tab.
-> Sometimes files flash betweem selected file and
file which had focus before. 

3 case:
Try run swing application. Close this app. , and
try 2 case.

This behaviour is appeared in Editor, Output window.

This issue blocks GUI tests and it's very user
confusing.
Comment 1 pfelenda 2003-01-22 16:28:48 UTC
build [200301220100], jdk1.4.1_b21
Comment 2 Marian Mirilovic 2003-01-23 15:32:12 UTC
[nb_dev](20030123), [jdk1.4.2](b14)
100% reproducible scenario :
- run IDE
- on selected dolder push from context menu New | New ...
- select Others | Properties
- push Finish button
-> new file is opened but the previous tab is still selected

Comment 3 mslama 2003-01-23 15:53:51 UTC
MainWindow receives focus AFTER TopComponent (QuietEditorPane).
Comment 4 mslama 2003-01-24 15:48:00 UTC
Following analysis is for JDK 1.4.1_01.

It seems it is not one issue. Please file new for rest. I investigated
behaviour when you create new Java class using JavaWizardIterator. In
this case it is really nasty behaviour.

In the end event FOCUS_GAINED is received for MainWindow. I
investigated where it comes from and it is really weird. This event is
created in KeyboardFocusManager.retargetFocusEvent(). Original event
is again FOCUS_GAINED event with the same source. And this event is
created when JavaWizardIterator calls EditorSupport.open() ->
TopComponent.requestFocus() -> QuietEditorPane.requestFocus(). But
this is translated to focus event with MainWindow as source. This
event is somewhere stored (some queue) and processed in the end of all
focus events generated later. I have no idea why it happens. Call is
done after JDialog.show().

Workaround is to call actionPerformed() using invokeLater(). I
reassign to java module I will attach part of log where is call stack
when original focus event is created. I will attach also diff of
suggested fix.
Comment 5 mslama 2003-01-24 15:50:05 UTC
Fixing description to make clear what issue is this. It is first case
at beginning of description
Comment 6 mslama 2003-01-24 15:50:41 UTC
Sorry I fixed summary in previous commit.
Comment 7 mslama 2003-01-24 15:56:03 UTC
Created attachment 8670 [details]
Log where focus event is created
Comment 8 mslama 2003-01-24 15:58:18 UTC
Created attachment 8671 [details]
Diff of suggested fix
Comment 9 Marian Mirilovic 2003-01-30 09:48:48 UTC
bug in the properties was separatelly filed as issue 30510
Comment 10 Tomas Hurka 2003-01-31 14:33:23 UTC
Slightly modified patch from Marek applied to the trunk. Reassign back to core for additional fixes.
Comment 11 Tomas Hurka 2003-01-31 14:42:10 UTC
java module fixed merged to QBE200301290100 branch
/cvs/java/src/org/netbeans/modules/java/ui/wizard/JavaWizardIterator.java,v  <--  JavaWizardIterator.java
new revision: 1.14.4.1; previous revision: 1.14
done
Comment 12 mslama 2003-01-31 16:17:22 UTC
Fixed in trunk and Q-build branch QBE200301290100. Call of
setVisible(false) on scroll pane in DesktopPane caused another
FOCUS_LOST event.

Modified trunk:
core/src/org/netbeans/core/windows/frames/DesktopPane.java r.1.30

Modified q-build branch:
core/src/org/netbeans/core/windows/frames/DesktopPane.java r.1.28.4.1
Comment 13 Jiri Rechtacek 2003-01-31 17:41:14 UTC
*** Issue 30554 has been marked as a duplicate of this issue. ***
Comment 14 Marian Mirilovic 2003-02-03 08:26:50 UTC
verified in [nb_dev](20030203)