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 - OutlineView forgets to set selection colors before FocusListener is invoked the first time
Summary: OutlineView forgets to set selection colors before FocusListener is invoked t...
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Outline&TreeTable (show other bugs)
Version: 7.4
Hardware: PC Mac OS X
: P3 normal with 1 vote (vote)
Assignee: Jaroslav Havlin
URL:
Keywords: NETFIX, PATCH_AVAILABLE
Depends on:
Blocks:
 
Reported: 2013-11-09 23:33 UTC by ebakke
Modified: 2014-02-07 02:41 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
OutlineView appears focused even though focus is in the search bar (54.36 KB, image/png)
2013-11-09 23:33 UTC, ebakke
Details
Suggested fix (two-line change to OutlineView.java) (1.95 KB, patch)
2013-11-09 23:34 UTC, ebakke
Details | Diff
Simple example platform application that exhibits the bug (24.87 KB, application/octet-stream)
2013-11-09 23:36 UTC, ebakke
Details

Note You need to log in before you can comment on or make changes to this 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