Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / November 2003

Tip: Looking for answers? Try searching our database.

3D text in JButton

Thread view: 
Jakov - 04 Nov 2003 10:48 GMT
Hi, I have a problem.

How to have 3D text in JButton. Text could be in a various fonts.
Any help appreciated....

Jakov
Thomas Weidenfeller - 04 Nov 2003 13:32 GMT
> How to have 3D text in JButton. Text could be in a various fonts.
> Any help appreciated....

If we ignore for a moment the fact that this looks ugly, you would have
to do it yourself. There is no support in J2SE.

The simplest would maybe be to license some 3D TrueType font and just
use that one like any other font on the JButton.

/Thomas
Igor Buzatovic - 04 Nov 2003 14:25 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.

> /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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.