> How to have 3D text in JButton. Text could be in a various fonts.
> Any help appreciated....
> > How to have 3D text in JButton. Text could be in a various fonts.
> > Any help appreciated....
[quoted text clipped - 4 lines]
> The simplest would maybe be to license some 3D TrueType font and just
> use that one like any other font on the JButton.
....or to override JButton's paintComponent method. Thiss assumes writing
your own class which extends jbutton.
> /Thomas
Thomas Weidenfeller - 04 Nov 2003 14:53 GMT
> ....or to override JButton's paintComponent method. Thiss assumes writing
> your own class which extends jbutton.
I thought about suggesting this, and also suggesting to use an icon.
But I couldn't think of a good method to extrude a 2D font on the fly
to a 3D object, and then rendering it on a 2D surface in Java:
You don't get the font vector data from the Java font system, so you
would have to extrude from rendered text. This would require some
processing and won't give you great results. Or you would have to write
a parser for the font data so you get the vector data. Or you would
have to embedd some font data into the Java program directly. And/or
you embedd a 3D font renderer into the application, which uses some 3D
font data. Non of this sounds too great to me.
IMHO the simplest is to use an existing TT font with a 3D look.
/Thomas
Roald Ribe - 04 Nov 2003 21:17 GMT
> > ....or to override JButton's paintComponent method. Thiss assumes writing
> > your own class which extends jbutton.
[quoted text clipped - 12 lines]
>
> IMHO the simplest is to use an existing TT font with a 3D look.
Do as Igor suggested, and take a look at
http://www.webtechniques.com/archives/2000/04/java/
There is a section named 3D Text there. You may want to
draw to a memory image first, and blit it to the screen
when necessary.
Roald
Jakov - 05 Nov 2003 08:28 GMT
> > > How to have 3D text in JButton. Text could be in a various fonts.
> > > Any help appreciated....
[quoted text clipped - 4 lines]
> > The simplest would maybe be to license some 3D TrueType font and just
> > use that one like any other font on the JButton.
> ....or to override JButton's paintComponent method. Thiss assumes writing
> your own class which extends jbutton.
I did it this way. It looks good, In Metal and Motif L&F it reacts good.
But in Windows there is a small problem. When button is pressed, text is
moved
one pixel down and one pixel right(It doesn't occur in Metal or Motif L&F).
Should
make custom class which implements ButtonUI for drawing, for doing rendering
when
button pressed, otherwise it is OK...
Jakov
> > /Thomas