JPanel () { final JPanel progressPanel = new JPanel(new GridBagLayout()); myTitleLabel = new JLabel(); myTitleLabel.setFont(StartupUiUtil.getLabelFont().deriveFont(Font.BOLD)); progressPanel.add(myTitleLabel, new GridBagConstraints(0, RELATIVE, 2, 1, 1.0, 0.0, NORTHWEST, HORIZONTAL, JBUI.insets(8, 10, 5, 10), 0, 0)); myProgressLabel = new JLabel(); progressPanel.add(myProgressLabel, new GridBagConstraints(0, RELATIVE, 1, 1, 1.0, 0.0, NORTHWEST, HORIZONTAL, JBUI.insets(8, 10, 0, 10), 0, 0)); myProgressLabel2 = new JLabel() { @Override public void setText(@Nls String text) { super.setText(StringUtil.trimMiddle(text, 80)); } }; progressPanel.add(myProgressLabel2, new GridBagConstraints(0, RELATIVE, 1, 1, 1.0, 1.0, NORTHWEST, HORIZONTAL, JBUI.insets(8, 10, 0, 10), 0, 0)); JButton stopButton = new JButton(JavaUiBundle.message("button.stop.searching")); stopButton.addActionListener(__ -> cancelSearch()); progressPanel.add(stopButton, new GridBagConstraints(1, RELATIVE, 1, 2, 0.0, 1.0, NORTHWEST, NONE, JBUI.insets(10, 0, 0, 10), 0, 0)); return progressPanel; }