private static void addField(JPanel panel, ReferenceEditorWithBrowseButton field) {
      panel.add(field, BorderLayout.CENTER);

      final Component[] components = panel.getParent().getComponents();
      final int index = Arrays.asList(components).indexOf(panel);
      if (index > 0) {
        final Component component = components[index - 1];
        if (component instanceof JLabel) {
          ((JLabel)component).setLabelFor(field);
        }
      }
    }
private static void addField(JPanel panel, ReferenceEditorWithBrowseButton field)