File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes drawString and exponents Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "drawString and exponents" Watch "drawString and exponents" New topic
Forums: Swing / AWT / SWT Beginning Java
Author

drawString and exponents

Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 815
Is there a simple way to use drawString and print out an equation with exponents?
Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 815
OK. So I can achieve superscript and I can achieve making font larger but it seems that I cannot do both at the same time. Any suggestions on achieving both?
Make font larger

Add a superscript

This won't do both, will only increase the font.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37907
    
  22
If you are doing graphics, that might be better discussed in the GUIs forum. Nil desperandum! I can copy this discussion so it is in both fora

Are you aware of superscript characters? You can probably use \u2074 and get ⁴. More details here, and it tells you where to look (\u00b2, I think) for ².
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

You could try setting the Font attributes instead. My Visual Font Designer can help generate the code painlessly. Or maybe using the form of AttributedString#addAttribute(...) that takes a Map would produce the desired result.

To get better help sooner, post a SSCCE (Short, Self Contained, Correct (Compilable), Example) that demonstrates your problem.

luck, db
There are no new questions, but there may be new answers.
 
 
subject: drawString and exponents
 
Similar Threads
Thinking in Java excercise
dividing floating point numbers?
Retrieving Text from drawString()
pen problems
Java chart printing problems