@@ -103,7 +103,8 @@ public class SwingSearchBar extends JTextField {
103103 private static final String DEFAULT_MESSAGE = "Click here to search" ;
104104 private static final Color ACTIVE_FONT_COLOR = new Color (0 , 0 , 0 );
105105 private static final Color INACTIVE_FONT_COLOR = new Color (150 , 150 , 150 );
106- private static final Color SELECTED_RESULT_COLOR = new Color (70 , 152 , 251 );
106+ private static final Color SELECTED_RESULT_COLOR = new Color (186 , 218 , 255 );
107+ private static final String CONTEXT_COLOR = "#8C745E" ;
107108 private static final int ICON_SIZE = 16 ;
108109 private static final int PAD = 5 ;
109110
@@ -348,8 +349,14 @@ public SwingSearchPanel(final Context context) {
348349
349350 final Container parent = getParent ();
350351
352+ String resultSizeStr = "" ;
353+ final int resCount = ((SearchResultHeader ) value ).resultCount ();
354+ if (resCount > resultLimit ) {
355+ resultSizeStr += " <span style='color: " + CONTEXT_COLOR + ";'>(" + resultLimit + "/" + resCount + ")" ;
356+ }
357+
351358 final JCheckBox headerBox = //
352- new JCheckBox (searcher .title (), searchService .enabled (searcher ));
359+ new JCheckBox ("<html>" + searcher .title () + resultSizeStr , searchService .enabled (searcher ));
353360 headerBox .setFont (smaller (headerBox .getFont (), 2 ));
354361 if (parent != null ) headerBox .setBackground (parent .getBackground ());
355362 headerCheckboxes .put (searcher .getClass (), headerBox );
@@ -373,9 +380,10 @@ public SwingSearchPanel(final Context context) {
373380 item .setBorder (new EmptyBorder (1 , PAD , 0 , PAD ));
374381 item .add (icon (value .iconPath ()));
375382 item .add (Box .createHorizontalStrut (3 ));
376- final JTextArea name = new JTextArea ();
377- name .setText (value .identifier ());
378- name .setEditable (false );
383+ final JLabel name = new JLabel ();
384+ Font f = name .getFont ();
385+ name .setFont (f .deriveFont (f .getStyle () & ~Font .BOLD ));
386+ name .setText ("<html>" + value .identifier () + " <span style='color: " + CONTEXT_COLOR + ";'>" + value .context () + "</span>" );
379387 name .setBackground (null );
380388 item .add (name );
381389 item .setBackground (isSelected ? SELECTED_RESULT_COLOR : list .getBackground ());
@@ -642,8 +650,10 @@ private void rebuild() {
642650
643651 if (completeResults == null ) continue ;
644652
653+ int resultCount = completeResults .size ();
654+
645655 // Add section header.
646- listModel .addElement (new SearchResultHeader (searcher ));
656+ listModel .addElement (new SearchResultHeader (searcher , resultCount ));
647657
648658 if (completeResults .isEmpty ()) continue ;
649659
@@ -809,9 +819,15 @@ public void keyPressed(final KeyEvent e) {
809819 private class SearchResultHeader implements SearchResult {
810820
811821 private final Searcher searcher ;
822+ private final int resultCount ;
812823
813- public SearchResultHeader (final Searcher searcher ) {
824+ public SearchResultHeader (final Searcher searcher , int resultCount ) {
814825 this .searcher = searcher ;
826+ this .resultCount = resultCount ;
827+ }
828+
829+ public int resultCount () {
830+ return resultCount ;
815831 }
816832
817833 public Searcher searcher () {
0 commit comments