Hi,

I am trying to design an applet to draw parabola. The equation displayed is something like:

y = 3x^2 + 5x + 7

which is ugly.

Is there a way I can display the formal math equation? Like this:

http://img696.imageshack.us/img696/7949/matht.png

Printable View

- 06-22-2011, 07:22 PMcalnasticMath equation in Java Applet
Hi,

I am trying to design an applet to draw parabola. The equation displayed is something like:

y = 3x^2 + 5x + 7

which is ugly.

Is there a way I can display the formal math equation? Like this:

http://img696.imageshack.us/img696/7949/matht.png - 06-22-2011, 07:30 PMKevinWorkman
How are you displaying it? Using a JLabel? A JTextField? The Graphics.drawString() method? Something else?

In short, the answer is yes. But it depends on how you're doing your drawing. - 06-22-2011, 07:48 PMcalnastic
I am using a JLabel

- 06-22-2011, 07:48 PMKevinWorkman
In that case, you could probably use HTML.

- 06-22-2011, 07:54 PMJavaForums
What do you mean with ugly? I guess that it does not look smooth.

You can use a plotting library. Check this:

http://www.java-forums.org/new-java/...freechart.html - 06-22-2011, 08:11 PMKevinWorkman
I was under the impression that he was talking about the text display of the actual equation, not the graph itself. In which case, HTML tags might work. I could be wrong though.

- 06-22-2011, 08:14 PMJavaForums
- 06-22-2011, 09:00 PMJosAH
html sucks; look what my expression transmogrifier did to the OP's example:

Code:`-<i>x</i><sup><font color=\"#8000\">2</font></sup>−<font color=\"#8000\">6</font>·<i>x</i>+<font color=\"#8000\">7</font>`

kind regards,

Jos - 06-22-2011, 09:33 PMJavaForums
Good question! Our friend google returned this:

JLaTeXMath - A Java API to render LaTeX - A Java package to display LaTeX code in mathematical mode - 06-23-2011, 02:27 AMJodokus
@ administrator:

I just tried it with your link. It works. I have a JButton now with a complicated formula on it (as an icon). Now I seem to have to learn TEX to make formulas other then this example.

@OP:

I had some difficulty finding an example. I used Feature Requests - JAMWiki Java Wiki Engine If you need more help, I'm an expert now :(clap): - 06-23-2011, 07:36 AMJosAH