3535import java .awt .Color ;
3636import java .awt .Component ;
3737import java .awt .Dimension ;
38+ import java .awt .GridLayout ;
3839import java .awt .Window ;
3940import java .awt .event .FocusEvent ;
4041import java .awt .event .FocusListener ;
6566import javax .swing .SwingConstants ;
6667import javax .swing .border .CompoundBorder ;
6768import javax .swing .border .EmptyBorder ;
68- import javax .swing .border .LineBorder ;
6969import javax .swing .border .MatteBorder ;
7070import javax .swing .event .DocumentEvent ;
7171import javax .swing .event .DocumentListener ;
7272
73- import net .miginfocom .swing .MigLayout ;
74-
7573import org .scijava .Context ;
7674import org .scijava .Priority ;
7775import org .scijava .plugin .Parameter ;
@@ -309,7 +307,6 @@ public SwingSearchPanel() {
309307 final JLabel detailsTitle = new JLabel ();
310308 detailsTitle .setHorizontalAlignment (SwingConstants .CENTER );
311309 final JPanel detailsProps = new JPanel ();
312- detailsProps .setLayout (new MigLayout ("fillx,wrap 2" , "[50%|50%]" ));
313310 final JPanel detailsButtons = new JPanel ();
314311 detailsButtons .setLayout (new BoxLayout (detailsButtons , BoxLayout .X_AXIS ));
315312 detailsTitle .setAlignmentX (0.5f );
@@ -320,15 +317,12 @@ public SwingSearchPanel() {
320317 detailsPane .add (detailsTitle );
321318 detailsPane .add (detailsProps );
322319 detailsPane .add (detailsButtons );
323- // DEBUG
324- detailsTitle .setBorder (new LineBorder (Color .red , 1 ));
325- detailsProps .setBorder (new LineBorder (Color .red , 1 ));
326- detailsButtons .setBorder (new LineBorder (Color .red , 1 ));
320+ detailsPane .add (Box .createVerticalGlue ());
327321
328322 resultsList .addListSelectionListener (lse -> {
329323 if (lse .getValueIsAdjusting ()) return ;
330324 final SearchResult result = resultsList .getSelectedValue ();
331- if (result == null ) {
325+ if (result == null || isHeader ( result ) ) {
332326 // clear details pane
333327 detailsTitle .setText ("" );
334328 detailsProps .removeAll ();
@@ -338,12 +332,18 @@ public SwingSearchPanel() {
338332 // populate details pane
339333 detailsTitle .setText ("<html><h2>" + result .name () + "</h2>" );
340334 detailsProps .removeAll ();
335+ detailsProps .setLayout (new GridLayout (result .properties ().size (), 2 ));
341336 result .properties ().forEach ((k , v ) -> {
342- final JLabel kLabel = new JLabel (
343- "<html><strong style=\" color: gray\" >" + k + "</strong>" );
344- kLabel .setHorizontalAlignment (SwingConstants .RIGHT );
345- detailsProps .add (kLabel );
346- detailsProps .add (new JLabel (v ));
337+ final JLabel keyLabel = new JLabel ("<html>" +
338+ "<strong style=\" color: gray; padding-right: 5px\" >" + k +
339+ " </strong>" , SwingConstants .RIGHT );
340+ detailsProps .add (keyLabel );
341+ final JTextField valueField = new JTextField ();
342+ valueField .setText (v );
343+ valueField .setEditable (false );
344+ valueField .setBackground (null );
345+ valueField .setBorder (null );
346+ detailsProps .add (valueField );
347347 });
348348 detailsButtons .removeAll ();
349349 final List <SearchAction > actions = searchService .actions (result );
@@ -453,9 +453,7 @@ private List<SearchResult> results(final Searcher searcher) {
453453 private Component icon (final String iconPath ) {
454454 // TODO make icon() return URL, not String.
455455 if (iconPath == null || iconPath .isEmpty ()) return emptyIcon ();
456- // final URL iconURL = getClass().getResource(iconPath);
457- // TEMP FOR TESTING
458- final URL iconURL = getClass ().getResource ("/icons/legacy.png" );
456+ final URL iconURL = getClass ().getResource (iconPath );
459457 final ImageIcon icon = new ImageIcon (iconURL );
460458 if (icon .getIconWidth () != ICON_SIZE || //
461459 icon .getIconHeight () != ICON_SIZE )
0 commit comments