Win a copy of Programmers Guide to Apache Thrift this week in the Open Source forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Is there any way to add a border to only ONE side of a button (i.e. north, south, east, west)  RSS feed

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good morning,

As mentioned above it's quite a simple objective but seems quite complex to accomplish - there seems no in-built method available for adding a border to only one side of a button (which makes sense I suppose since a border is supposed to SURROUND the button).

Any suggestions?

Thank you.

Stephen.
 
Marshal
Posts: 64473
225
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to our GUIs forum.

Did you find anything useful in the Java™ Tutorials? The bottom part of the second image there seems to show a Border on the left only, and the text suggests they set the width to 0 on the other sides, but I didn't read the whole of the link.
 
Saloon Keeper
Posts: 3250
128
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Stephen,

it is certainly possible, what you need is MatteBorder (see the API). I have a KillerSudoku application, where I indicate the groups using this MatteBorder. I made a Map<String, MatteBorder>, where the String is say "TL", meaning the border of the component should be top and left. I can then simply say:

The code I use is: (pixels indicate how large the border part will be, in pixels)


 
Stephen Pillinger
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you both - the MatteBorder is definitely the answer here I didn't realise how simple it was until I applied it thanks a lot for the help!
 
Campbell Ritchie
Marshal
Posts: 64473
225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Stephen Pillinger wrote:Thank you . . .

That's a pleasure
 
Piet Souris
Saloon Keeper
Posts: 3250
128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome!
 
Are we home yet? Wait, did we forget the tiny ad?
ScroogeXHTML - small and flexible RTF to HTML converter library
https://coderanch.com/t/710903/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!