• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

[Graphics2D] Drawing double rounded corners border.

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am struggling to make a double border which has rounded corners. The border should be 2 parallel lines.

I made something which looks almost good, but if you look closer there are a few wrong things.
To achieve this, I made 2 paths, then painted them in 2 different colours.

The main problem is painting with AA, because the colours overlap and are affected.

I think it would be smoother to paint a single path using 2 colours.

For the first problem, I think some kind of a stroke would be enough. But, if I build a stroke, it's almost same thing like drawing the path twice, like I did before. Anyway i think that would fix AA problem. But still, maybe I can achieve a smoother effect for the corners.

Question:

Do you think there is other solution which is better than what I tried ?
Maybe something with a 2x1 Texture ? It's possible to achieve this ? I know I tried this before and when a curve was encountered the direction of the texture was wrong and looked messy.

Thank you!

PS: Ignore the blueish thing, it's a dragged component to activate the highlight border.
Screenshot-from-2014-03-26-16-20-51.png
[Thumbnail for Screenshot-from-2014-03-26-16-20-51.png]
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe you can use a CompoundBorder. See the Swing tutorial on How to Use Borders for some examples.

Post your SSCCE that demonstrates the problem, maybe someone can off some advice.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic