JComponent () { JLabel label = new JLabel(myMessage); label.setUI(new MultiLineLabelUI()); JPanel panel = new JPanel(new BorderLayout()); panel.add(label, BorderLayout.CENTER); Icon icon = Messages.getQuestionIcon(); label.setIcon(icon); label.setIconTextGap(7); return panel; }