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 221692 - IDE focus gets lost when Browser Log and CSS Styles are both opened
Summary: IDE focus gets lost when Browser Log and CSS Styles are both opened
Alias: None
Product: web
Classification: Unclassified
Component: CSS Visual Tools (show other bugs)
Version: 7.3
Hardware: PC Linux
: P3 normal (vote)
Assignee: Jan Stola
Depends on:
Reported: 2012-11-08 07:21 UTC by Vladimir Riha
Modified: 2014-10-06 13:25 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:

test project (1.86 KB, application/x-sdlc)
2012-11-18 22:09 UTC, David Konecny

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Riha 2012-11-08 07:21:52 UTC
To reproduce:
- open several files (JS, HTML etc.)
- run some HTML file that is using console.log so something is printed to Browser log window and it is opened
- switch to one file in IDE, place cursor in it
- switch to another file, place cursor in it
- switch back to the first file

=> cursor (focus) is placed in Browser log instead of the first file 

Product Version: NetBeans IDE Dev (Build web-main-9149-on-20121108)
Java: 1.7.0_10-ea; Java HotSpot(TM) Client VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_10-ea-b11
System: Linux version 3.2.0-32-generic-pae running on i386; UTF-8; en_US (nb)
Comment 1 David Konecny 2012-11-08 23:38:15 UTC
I cannot reproduce it. Does something new gets logged into the Browser log or not?
Comment 2 Vladimir Riha 2012-11-09 14:43:32 UTC
There was just some logging that happened on document.ready but this was happening after time after the log was printed. I'm sorry, I can't reproduce it in today's trunk build :/
Comment 3 Vladimir Riha 2012-11-18 14:49:54 UTC
I noticed some more information when I reproduced it in today's build:
- open JS file and HTML file in IDE
- run html file in browser, some logging were produced and showed in Browser log
- edit JS file
- switch to HTML file using Ctrl+Tab
=> Browser log has focus, now if I switch back to JS file with Ctrl+Tab, JS file has correctly focus. Switching back again to HTML again makes Browser log focused instead of editor

Product Version: NetBeans IDE Dev (Build 201211180002)
Java: 1.7.0; Java HotSpot(TM) 64-Bit Server VM 21.0-b17
Runtime: Java(TM) SE Runtime Environment 1.7.0-b147
System: Linux version 3.5.0-18-generic running on amd64; UTF-8; en_US (nb)
Comment 4 Vladimir Riha 2012-11-18 14:50:58 UTC
Also it happens only if CSS Styles window is opened. Once I close it, the focus is where it supposed to be.
Comment 5 David Konecny 2012-11-18 22:09:42 UTC
Created attachment 128023 [details]
test project
Comment 6 David Konecny 2012-11-18 22:21:20 UTC
I can reproduce it now. Thanks Vlada. It looks to me like a Window System issue. Few observations:

* when focus is lost it is not in Browser Log output window - I actually do not know where it is because no keyboard action has any visual impact
* the problem happens only when "Browser Log" and "CSS Styles" are opened at the same time
* rearranging CSS Styles and Browser Log windows make problem go away; and by rearranging I mean dragging Browser Log somewhere else (when non-HTML file is selected in editor) and then drag it back and everything is OK from now on

I'm attaching simple test project. Open it in IDE and:
* open both html and js file from the Site Root
* run project (will open Browser Log)
* focus editor and use Ctrl-Tab to switch between js and html -> focus get lots when you switch yo HTML and CSS Styles window becomes visible.
Comment 7 Stanislav Aubrecht 2012-11-19 10:57:28 UTC
It's not a window system issue. 
You can press Ctrl+Shift+Pause/Break keys to print currently focused component into IDE log. When I tried the steps to reproduced provided above the focus was either in CSS Styles window's toolbar or in its property sheet (SheetTable) even though it's empty.
Comment 8 Marek Fukala 2012-11-19 22:01:00 UTC
>the focus was either in CSS Styles window's toolbar 

can anyone with good knowledge of the steps to reproduce check if web-main#fafd9eb49a50 helps please? Thanks.

>or in its property sheet (SheetTable)
>even though it's empty.

I don't know what (if) can I do about that. Lets first check if the fix above helps.
Comment 9 Vladimir Riha 2012-11-19 22:21:13 UTC
I'll try it tomorrow
Comment 10 Vladimir Riha 2012-11-20 11:11:21 UTC
I'm sorry, not fixed. If you try David's steps from comment #6, you can press Ctrl+W to close the focused window and CSS Styles are closed.

The reason I thought Browser log steals it, is that it has blinking "|" (cursor) inside and Ctrl+Shift+PauseBreak prints

*** ShortcutAndMenuKeyEventProcessor: current focus owner = javax.swing.JEditorPane[,0,-16,1537x276,layout=javax.swing.plaf.basic.BasicTextUI$UpdateHandler,alignmentX=0.0,alignmentY=0.0,border=javax.swing.plaf.synth.SynthBorder@e75f90,flags=296,maximumSize=,minimumSize=,preferredSize=,caretColor=javax.swing.plaf.ColorUIResource[r=0,g=0,b=0],disabledTextColor=javax.swing.plaf.ColorUIResource[r=255,g=255,b=255],editable=false,margin=javax.swing.plaf.InsetsUIResource[top=3,left=3,bottom=3,right=3],selectedTextColor=javax.swing.plaf.ColorUIResource[r=255,g=255,b=255],selectionColor=javax.swing.plaf.ColorUIResource[r=154,g=154,b=154],kit=org.netbeans.core.output2.OutputEditorKit@c6a2c1,typeHandlers=]

but Ctrl+W closes CSS Styles and not Browser log... If I close CSS Styles window, open it again and repeat the steps again (so run html again and start switching tabs using Ctrl+Tab), the shortcut gives me

*** ShortcutAndMenuKeyEventProcessor: current focus owner = org.netbeans.modules.navigator.NavigatorTC[Navigator,1,0,334x448,layout=java.awt.BorderLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=320,maximumSize=,minimumSize=,preferredSize=]

I still can't write anywhere visible, but Ctrl+W closes editor window as expected. So editor "doesn't seem to have cursor"

Product Version: NetBeans IDE Dev (Build web-main-9264-on-20121120)
Java: 1.7.0_10-ea; Java HotSpot(TM) Client VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_10-ea-b16
System: Linux version 3.2.0-33-generic-pae running on i386; UTF-8; en_US (nb)
Comment 11 David Konecny 2012-11-21 02:12:06 UTC
(In reply to comment #10)
> The reason I thought Browser log steals it, is that it has blinking "|"
> (cursor) inside

That never happened to me. 

Dumping focus I'm getting:

*** ShortcutAndMenuKeyEventProcessor: current focus owner = null

but CTRL-W does close the source editor. I'm running with Marek's fix as well.
Comment 12 Quality Engineering 2012-11-21 13:40:57 UTC
Integrated into 'main-golden', will be available in build *201211211016* on (upload may still be in progress)
User: Marek Fukala <>
Log: #221692 - do not request focus for filter field in the DocumentViewPanel constructor