If I understand you correctly, you can do something like this:

// Panel that needs a title
JPanel panel = new JPanel();
panel.setLayout(new GridBagLayout());

Image titleImage = new Image("c:/images/title.gif");
JLabel titleLabel = new JLabel();  
JPanel titleLabelPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));

titleLabel.setIcon(new ImageIcon(titleImage));
titleLabelPanel.add(titleLabel);

panel.add(titleLabelPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0
            ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new
Insets(0, 0, 0, 0), 0, 0));

panel.add(//.... anything else you want to add....//);


-----Original Message-----
From: Samir [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 31, 2002 4:49 PM
To: 'Swing mailing list - mailman'
Subject: TitledBorder with label


Hi all,

How do I set a titled border to a JPanel which displays a JLabel instead of
a string?

regards
Samir



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to