Code example for JLabel

Methods: setBorder

0
            innerPanel.add(titleLabel, BorderLayout.NORTH);
        } 
        add(innerPanel, BorderLayout.CENTER);
 
        if (icon != null) {
            JLabel iconLabel = new JLabel(icon);
            iconLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
            add(iconLabel, BorderLayout.EAST);
        } 
    } 
 
    public void setTitle(String title) {
        titleLabel.setText("<html><div style=\"font-size: 9px\"><b>" + title + "</b></div></html>");
    } 
 
    public void setDescription(String description) {
        descriptionLabel.setText("<html><div style=\"font-size: 9px\">" + description + "</div></html>");
    } 
}