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.
While doing logging of calls to request focus, I noticed that on every startup, the thing that gets focused once the main window comes up is a toolbar button. Shouldn't it be Explorer or the editor or something else? REQUEST FOCUS ON org.openide.awt.Actions$ToolbarButton [,15,3,23x23,layout=javax.swing. OverlayLayout,alignmentX=0.0,alignmentY=0.5,borde r=javax.swing.border.EmptyBorder@1a7a 05,flags=296,maximumSize=,minimumSize=,preferredS ize=,defaultIcon=javax.swing.ImageIco n@1509f8b,disabledIcon=,disabledSelectedIcon=,mar gin=javax.swing.plaf.InsetsUIResource [top=2,left=14,bottom=2,right=14],paintBorder=tru e,paintFocus=true,pressedIcon=,rollov erEnabled=true,rolloverIcon=,rolloverSelectedIcon =,selectedIcon=,text=,defaultCapable= false] java.lang.Exception: Stack trace at java.lang.Thread.dumpStack (Thread.java:1064) at java.awt.Component.requestFocusHelper (Component.java:6098) at java.awt.Component.requestFocus (Component.java:5948) at javax.swing.JComponent.requestFocus (JComponent.java:1113) at org.netbeans.core.windows.view.ViewHierarchy.upda teViewHierarchy(ViewHierar chy.java:121) at org.netbeans.core.windows.view.DefaultView.change GUI(DefaultView.java:96) at org.netbeans.core.windows.ViewRequestor.dispatchR equest(ViewRequestor.java: 240) at org.netbeans.core.windows.ViewRequestor.processRe quest(ViewRequestor.java:2 19) at org.netbeans.core.windows.ViewRequestor.postReque st(ViewRequestor.java:155) at org.netbeans.core.windows.ViewRequestor.scheduleR equest(ViewRequestor.java: 95) at org.netbeans.core.windows.Central.setActiveMode (Central.java:149) at org.netbeans.core.windows.Central.userActivatedMo de(Central.java:1278) at org.netbeans.core.windows.view.DefaultView.userAc tivatedModeView(DefaultVie w.java:421) at org.netbeans.core.windows.view.ui.TabbedListener$ 2.run(TabbedListener.java: 257) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:178) at java.awt.EventQueue.dispatchEvent (EventQueue.java:454) at java.awt.EventDispatchThread.pumpOneEventForHiera rchy(EventDispatchThread.j ava:201) at java.awt.EventDispatchThread.pumpEventsForHierarc hy(EventDispatchThread.jav a:151) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:145) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:137) at java.awt.EventDispatchThread.run (EventDispatchThread.java:100)
Fix for #38080 removed the hack which caused this. In fact, it was not requested for MainWindow button, but for component which had focus before the GUI hierarchy update, so it is preserved. But those calls were redundant (therefore the above fix). The reason it was about the button, since the button is default component in focusable policy of MainWindow.. maybe is worth to think about supplying our focus policy for main window which would manage the default component the one from active TopComponent. But I'd like to avoid this heavy solutions as long as possible.
verified