You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by lk...@apache.org on 2020/01/20 17:42:27 UTC

[netbeans] branch master updated: [NETBEANS-3717] Allow LaF to change the color of the selected item in Code Completion

This is an automated email from the ASF dual-hosted git repository.

lkishalmi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new 1406df7  [NETBEANS-3717] Allow LaF to change the color of the selected item in Code Completion
1406df7 is described below

commit 1406df7528c2dda294e8f2482f2ca399be571442
Author: Laszlo Kishalmi <la...@gmail.com>
AuthorDate: Mon Jan 20 08:18:05 2020 -0800

    [NETBEANS-3717] Allow LaF to change the color of the selected item in Code Completion
---
 .../modules/editor/completion/CompletionScrollPane.java      | 12 ++++++++++++
 .../src/org/netbeans/swing/laf/flatlaf/FlatLaf.properties    |  3 +++
 2 files changed, 15 insertions(+)

diff --git a/ide/editor.completion/src/org/netbeans/modules/editor/completion/CompletionScrollPane.java b/ide/editor.completion/src/org/netbeans/modules/editor/completion/CompletionScrollPane.java
index 3737b16..d112dbd 100644
--- a/ide/editor.completion/src/org/netbeans/modules/editor/completion/CompletionScrollPane.java
+++ b/ide/editor.completion/src/org/netbeans/modules/editor/completion/CompletionScrollPane.java
@@ -37,6 +37,7 @@ import javax.swing.JLabel;
 import javax.swing.JScrollPane;
 import javax.swing.KeyStroke;
 import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
 import javax.swing.event.ListSelectionListener;
 import javax.swing.text.JTextComponent;
 import javax.swing.text.Keymap;
@@ -93,6 +94,17 @@ public class CompletionScrollPane extends JScrollPane {
 
         // Add the completion view
         view = new CompletionJList(maxVisibleRowCount, mouseListener, editorComponent);
+
+        // Apply selection colors as CompletionJList selecion also means focused
+        Color selBg = UIManager.getColor("nb.completion.selectedBackground"); //NOI18N
+        if (selBg != null) {
+            view.setSelectionBackground(selBg);
+        }
+        Color selFg = UIManager.getColor("nb.completion.selectedForeground"); //NOI18N
+        if (selFg != null) {
+            view.setSelectionForeground(selFg);
+        }
+
         if (listSelectionListener != null) {
             view.addListSelectionListener(listSelectionListener);
         }
diff --git a/platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatLaf.properties b/platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatLaf.properties
index b8bd120..00ab257 100644
--- a/platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatLaf.properties
+++ b/platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatLaf.properties
@@ -67,6 +67,9 @@ nb.multitabs.selectedForeground=$EditorTab.selectedForeground
 nb.multitabs.underlineColor=$TabbedPane.underlineColor
 nb.multitabs.inactiveUnderlineColor=$EditorTab.inactiveUnderlineColor
 
+#---- Code Completion ----
+nb.completion.selectedBackground=@selectionBackground
+nb.completion.selectedForeground=@selectionForeground
 
 #---- TabControlIcon ----
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists