Icon in titledBorder title
Posted
by Venno
on Stack Overflow
See other posts from Stack Overflow
or by Venno
Published on 2010-03-25T20:59:32Z
Indexed on
2010/03/25
21:43 UTC
Read the original article
Hit count: 380
Hi is it possible to place an icon in the title of a titledBorder for example the following code:
import java.awt.GridLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.TitledBorder;
public class TitledExample extends JPanel {
public TitledExample() {
super(true);
this.setLayout(new GridLayout(1, 1, 5, 5));
JLabel label = new JLabel("Titled Border");
label.setHorizontalAlignment(JLabel.CENTER);
TitledBorder titled = new TitledBorder("Image here ?? Title");
label.setBorder(titled);
add(label);
}
Thanks , Cheers
© Stack Overflow or respective owner