Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4625667

Strange FOCUS_GAINED event is sent to application

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P4
    • None
    • 1.4.0
    • client-libs
    • x86
    • linux_redhat_7.1

    Description

      FOCUS_GAINED event is sent to different than selected (requested) component.
      In our frame we have two JTabbedPane one at top with 4 tabs one at bottom with one tab. When first tab is selected at top and I select 4th tab at top before
      4th tab is selected - focus is set correctly to 4th tab in the end FOCUS_GAINED event is also sent to JToggleButton present in tab at bottom JTabbedPane.

      Steps to reproduce:
      1.Start Netbeans IDE in MDI mode. Editing workspace is selected.
      2.Select first tab 'Filesystems' in left window 'Explorer'. Now select 4th tab 'Runtime'. When you look at window title it is updated but before correct title is set it is obvious that it contains some other title for short time. We listen to focus events in Netbeans and update window title according to selected component (tab).

      It does not happen always but often so if you do not see it for the first time try it again. I am able to reproduce it on JDK 1.4.0-b91, Linux RH 7.1, kernel 2.4.10. I use development build of Netbeans IDE available from
      www.netbeans.org/downloads.html. It does not happen on JDK 1.3.1_02.

      I found that we receive FOCUS_GAINED event for JToggleButton at bottom tab before correct event for tab at top is received. I investigated where does this strange event come from and I found it is from KeyboardFocusManager. I add call stack from FocusEvent constructor. Last part in log is from our code to be sure that I log the same event instance.

      ## ## FocusEvent constructor [538b31]
      ## ## FocusEvent constructor source: [563cc2]
      java.lang.Exception: Stack trace
              at java.lang.Thread.dumpStack(Thread.java:1071)
              at java.awt.event.FocusEvent.<init>(FocusEvent.java:131)
              at java.awt.KeyboardFocusManager.retargetFocusEvent(KeyboardFocusManager.java:2434)
              at java.awt.Component.dispatchEventImpl(Component.java:3391)
              at java.awt.Container.dispatchEventImpl(Container.java:1437)
              at java.awt.Component.dispatchEvent(Component.java:3367)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:445)
              at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:190)
              at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:144)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)
      -- DCI.eventDispatched FOCUS_GAINED tc:Properties of RMI Registry isTemporary:false
           ev: 538b31
         comp: org.openide.awt.ToolbarToggleButton [563cc2]
       source: org.openide.awt.ToolbarToggleButton [563cc2]


      ###@###.### 2002-05-15
      It still happens with NB 3.3.1 and NB 3.4 dev build, JDK-1.4.0-b92, JDK-1.4.1-b09.

      There is change in NB 3.4 dev build: Javadoc tab was removed. There are now 3 tabs in Explorer but the behaviour is the same when you switch between first and last tab in Explorer - middle tab title appears for a moment in Explorer window title.

      Attachments

        Activity

          People

            Unassigned Unassigned
            mslamasunw Marek Slama (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: