Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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

Bevel...........can i make it

 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everybody,
Can somebody please tell me how do i implement bevel in JAVA...i can use rectangles ............but i need to implement bevel...
Can anybody explain me with some examples an explain the examples... so that i will understand it better
Kajol
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
forgive my ignorance, but whats a bevel!
could you throw more light on that.
Thanks.
- satya
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kajol,
Bevels are pretty easy... all that they really are are rectangles that are drawn using two colors so they have that 3D edge look. All you have to do to draw a beveled edge in Java ( other than use a beveled border in Swing ) is to draw the rectangle using lines ( i.e. g.drawLine( x1, y1, x2, y2 ) ). For this you need two points ( the upper left and lower right corners of the rectangle ) and the two colors you want the bevel to be ( the light edge and the dark edge ).
Here's a short function to draw a bevel...

HTH,
-Nate
P.S. - Madhav... just look around the edges of the buttons on this page. Those are bevels... the little 3D look that the edges of the buttons have.
[This message has been edited by Nathan Pruett (edited March 28, 2001).]
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
P.S. - Madhav... just look around the edges of the buttons on this page. Those are bevels... the
little 3D look that the edges of the buttons have.

Thanks Nate, I appreciate that.
I should get my skills Swinging....
- satya
 
Kajol Shroff
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nathan,
I tried ur method by first declaraing it in the class and then i called it ............but it dosent work.......
can u elaborate it ...........and expalin me with a full fledged program............as that would be really helpfull
Awaitng for ur reply.......
Kajol
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's an example class that uses the drawBevel method I wrote...

HTH,
-Nate
 
Kajol Shroff
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nathan,
Thanks a lot for ur example .........it expalined me everything ..
I was able to implement it........
Javaranch is Gr8 ........
Everybody i mean all the subscribers aare gr8 too...
It has taught me JAVA actually....
Kajol
reply
    Bookmark Topic Watch Topic
  • New Topic