JComponent (@NotNull Presentation presentation, @NotNull String place) { // honestly borrowed from SearchTextField final JPanel panel = new JPanel(new BorderLayout()); final JLabel label = new JLabel(myIcon); label.setOpaque(true); label.setBackground(myField.getBackground()); myField.setOpaque(true); panel.add(myField, BorderLayout.WEST); panel.add(label, BorderLayout.EAST); myField.setToolTipText(myDescription); label.setToolTipText(myDescription); final Border originalBorder; if (SystemInfo.isMac) { originalBorder = BorderFactory.createLoweredBevelBorder(); } else { originalBorder = myField.getBorder(); } panel.setBorder(new CompoundBorder(JBUI.Borders.empty(4, 0, 4, 0), originalBorder)); myField.setOpaque(true); myField.setBorder(JBUI.Borders.empty(0, 5, 0, 5)); new ClickListener() { @Override public boolean onClick(@NotNull MouseEvent e, int clickCount) { perform(); return true; } }.installOn(label); return panel; }