JComponent () { JLabel label = new JLabel(myMessage); label.setUI(new MultiLineLabelUI()); JPanel panel = new JPanel(new BorderLayout(10, 0)); if (myIcon != null) { panel.add(new JLabel(myIcon), BorderLayout.WEST); panel.add(label, BorderLayout.CENTER); } else { panel.add(label, BorderLayout.WEST); } return panel; }