• Post Reply Bookmark Topic Watch Topic
  • New Topic

JLabel borders

 
Timothy Hoyle
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have been creating a border for my JLabels from the LineBorder class. Right now I have my JLabels using and instance of createGrayLineBorder(). However, I would like my borders to only show up on the top and bottom of my JLabels, not on the right or left. (so an empty JLabel would look like two horizontal, parallel lines over a box)

I have searched on the internet for awhile, but my search has been in vain. Anyone know of a good link that explains how to accomplish this?
 
Campbell Ritchie
Marshal
Posts: 52598
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to our GUI forum.
 
Rob Camick
Ranch Hand
Posts: 2701
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use a MatteBorder. Read the section from the Swing tutorial on "How to Use Borders" for more information about this and other borders.
 
Timothy Hoyle
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob,

Thanks for the tip, I am using a MatteBorder and it is working like a charm.

Regards,

Tim Hoyle
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!