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 238197

Summary: OutlineView forgets to set selection colors before FocusListener is invoked the first time
Product: platform Reporter: ebakke
Component: Outline&TreeTableAssignee: Jaroslav Havlin <jhavlin>
Status: RESOLVED FIXED    
Severity: normal Keywords: NETFIX, PATCH_AVAILABLE
Priority: P3    
Version: 7.4   
Hardware: PC   
OS: Mac OS X   
Issue Type: DEFECT Exception Reporter:
Attachments: OutlineView appears focused even though focus is in the search bar
Suggested fix (two-line change to OutlineView.java)
Simple example platform application that exhibits the bug

Description ebakke 2013-11-09 23:33:31 UTC
Created attachment 142030 [details]
OutlineView appears focused even though focus is in the search bar

Here's another OutlineView bug--this one should be easy to fix.

If the OutlineView shows any selected nodes before receiving focus for the first time, the background color of the selected nodes is wrong--it looks as if the OutlineView is focused even though it is not. See the attached screenshot.

I had a look at the source code for OutlineView, and the reason for the bug is that the following two lines are only executed when a focus event is received, but not when the component is first created:

outline.setSelectionBackground(SheetCell.getNoFocusSelectionBackground());
outline.setSelectionForeground(SheetCell.getNoFocusSelectionForeground());

The solution is to include these two lines in the OutlineView constructor along with the registering of the FocusListener.
Comment 1 ebakke 2013-11-09 23:34:47 UTC
Created attachment 142031 [details]
Suggested fix (two-line change to OutlineView.java)
Comment 2 ebakke 2013-11-09 23:36:51 UTC
Created attachment 142032 [details]
Simple example platform application that exhibits the bug

Note that while I've only tested this on MacOS, the bug should be present on Windows as well.
Comment 3 Jaroslav Havlin 2014-01-24 14:49:11 UTC
The patch works fine.
Thank you very much, good job.
Comment 4 Jaroslav Havlin 2014-02-06 07:11:55 UTC
Patch was integrated as http://hg.netbeans.org/core-main/rev/7f1a9e50b8df.
Comment 5 Quality Engineering 2014-02-07 02:41:09 UTC
Integrated into 'main-silver', will be available in build *201402070001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/7f1a9e50b8df
User: Jaroslav Havlin <jhavlin@netbeans.org>
Log: #238197: OutlineView forgets to set selection colors before FocusListener is invoked the first time