Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JLabel borders  RSS feed

 
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
Sheriff
Posts: 53720
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to our GUI forum.
 
Rob Camick
Ranch Hand
Posts: 2752
11
  • 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!