Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   How to show math equations in a GUI (http://www.velocityreviews.com/forums/t390723-how-to-show-math-equations-in-a-gui.html)

stacey 02-08-2007 10:52 PM

How to show math equations in a GUI
 
Hello everyone!

I am making a help program, similar to those used from excel. So there
is main menu on the left panel..and depending on what you click,
different text is shown on the right panel.
I have to show some mathematical equations, like x^2 = (xi- xj) /
(S(x))^1/2 .. something like that.
but this way is not easy readable.. I want to make it like the
equation editor or mathtype in word.
A proper math type!

Any idea on how to do this???
Is there a ways i can format an equation? Otherwise, how can i insert
a picture? cause i am a bit confused on how this help menu works. (i
have done it using a jSplitPanel that has 2 jScrollPanels).

Thank you very much,

Regards,

Stacey


Oliver Wong 02-08-2007 11:31 PM

Re: How to show math equations in a GUI
 

"stacey" <staceyventuras@gmail.com> wrote in message
news:1170975121.937594.150260@s48g2000cws.googlegr oups.com...
> Hello everyone!
>
> I am making a help program, similar to those used from excel. So there
> is main menu on the left panel..and depending on what you click,
> different text is shown on the right panel.
> I have to show some mathematical equations, like x^2 = (xi- xj) /
> (S(x))^1/2 .. something like that.
> but this way is not easy readable.. I want to make it like the
> equation editor or mathtype in word.
> A proper math type!
>
> Any idea on how to do this???
> Is there a ways i can format an equation? Otherwise, how can i insert
> a picture? cause i am a bit confused on how this help menu works. (i
> have done it using a jSplitPanel that has 2 jScrollPanels).


By "help program", do you mean a program which displays mainly fixed,
static content in an attempt to teach the user something (e.g. some
mathematical principles)? If so, you may find it much easier to make the
bulk of your "program" in HTML, and use a couple of cleverly placed Java
applets for any interactive parts (quizzes? virtual experiments? interactive
diagrams? etc.)

While you can do what you want in pure Java, it won't be easy.

- Oliver



stacey 02-09-2007 12:08 AM

Re: How to show math equations in a GUI
 
> By "help program", do you mean a program which displays mainly fixed,
> static content in an attempt to teach the user something (e.g. some
> mathematical principles)? If so, you may find it much easier to make the
> bulk of your "program" in HTML, and use a couple of cleverly placed Java
> applets for any interactive parts (quizzes? virtual experiments? interactive
> diagrams? etc.)
>
> While you can do what you want in pure Java, it won't be easy.
>
> - Oliver


Well, i have made a tool in Java, and i want to make another help
application for it, to explain each step, and yes some mathematical
principles, but only mathematical equations.

It wont be easy huh? Cause i don't want to spend a looot of time. The
main program is of more importance!
Can you give me a guideline as to where i should turn to in order to
make it work as i said?

Thank you very much for your quick answer.

Stacey,


Stefan Schmiedl 02-09-2007 12:12 PM

Re: How to show math equations in a GUI
 
On Thu, 08 Feb 2007 16:08:35 -0800, stacey wrote:

>
> Well, i have made a tool in Java, and i want to make another help
> application for it, to explain each step, and yes some mathematical
> principles, but only mathematical equations.


The question is more like: Do you know the formulas before you deploy
the application or do you need to generate the displays "on the fly"
during run time?

>
> It wont be easy huh? Cause i don't want to spend a looot of time. The
> main program is of more importance!
> Can you give me a guideline as to where i should turn to in order to
> make it work as i said?


Depends on what you can install on the computer running your program.

One possible solution for a-priori-generation of formulas is to use
LaTeX or Lout for the typesetting part and just use the images.

Or you try to find a renderer for MathML.

OpenOffice.org has a formula editor (and renderer) buried somewhere
in the huge bulk that it is. Since it is open source, you might be
able to get some inspiration from there, too.

s.

stacey 02-09-2007 02:56 PM

Re: How to show math equations in a GUI
 

> The question is more like: Do you know the formulas before you deploy
> the application or do you need to generate the displays "on the fly"
> during run time?


No, i know the formulas. There are several standard that i will use.
The problem is how i ll represent them.

> Depends on what you can install on the computer running your program.
>
> One possible solution for a-priori-generation of formulas is to use
> LaTeX or Lout for the typesetting part and just use the images.
>
> Or you try to find a renderer for MathML.
>
> OpenOffice.org has a formula editor (and renderer) buried somewhere
> in the huge bulk that it is. Since it is open source, you might be
> able to get some inspiration from there, too.
>
> s.

I cannot install anything while running the problem. i wouldn't
suggest it, and i don't think they will let me.
So i ll try to find a renderer for MathML and if that fails i ll look
into the openoffice editor.

Thank you very much for your help Stefan, and you Andrew and Daniel
and for your quick answer!
If i encounter any problems, i will ask again :)

best regards,
Stacey Venturas.



Rogan Dawes 02-09-2007 04:41 PM

Re: How to show math equations in a GUI
 
stacey wrote:
> Hello everyone!
>
> I am making a help program, similar to those used from excel. So there
> is main menu on the left panel..and depending on what you click,
> different text is shown on the right panel.
> I have to show some mathematical equations, like x^2 = (xi- xj) /
> (S(x))^1/2 .. something like that.
> but this way is not easy readable.. I want to make it like the
> equation editor or mathtype in word.
> A proper math type!
>
> Any idea on how to do this???
> Is there a ways i can format an equation? Otherwise, how can i insert
> a picture? cause i am a bit confused on how this help menu works. (i
> have done it using a jSplitPanel that has 2 jScrollPanels).
>
> Thank you very much,
>
> Regards,
>
> Stacey
>


Take a look at JavaHelp (maybe a bit heavy duty, but that's your call)

You can include images in the HTML that you present to your users.

Rogan

robert maas, see http://tinyurl.com/uh3t 02-09-2007 08:32 PM

Re: How to show math equations in a GUI
 
(I trimmed off half your four newsgroups.)
> From: "stacey" <staceyventu...@gmail.com>
> I have to show some mathematical equations, like
> x^2 = (xi- xj) / (S(x))^1/2 ..
> something like that. but this way is not easy readable.. I want
> to make it like the equation editor or mathtype in word.


So you want it to display something like this?
2 (xi - xj)
x = --------------
1/2
(S(x)) ..

First you must have the internal representation of the mathematical
formulas in nested-list format, such as:
(= (expt x 2) (/ (- xi xj) (+ (expt (S x) 1/2) ..)))

Next you build panes bottom-up, first to contain atomic symbols
such as S and 1/2 and xi (or was that supposed to be
x-subscript-i??), then each layer combining lower layers together
into composite panes, with their parts arranged per some layout
manager. When you reach the top, you have the entire formula nicely
displayed in a master pane, which you can then display somewhere in
your window.

That's letting java do most of the work of managing layout.

If that's too slow (repainting such a complicated tree of panes
every time something moves or resizes), and you really do want to
spend the effort to lay out the entire equation in a single image
instead of nested panes, what you do is build virtual bitmap images
bottom-up, computing the size of each leaf (actual bitmap image),
computing the x,y offset of each small image within the next larger
*virtual* image, until you have a tree of such mostly-virtual
images. Then you build a bitmap pane big enough to whole the entire
toplevel virtual image, then traverse your tree copying each leaf
image through the various x,y offsets up to the top to paint it
into the one big collage-image.


All times are GMT. The time now is 03:17 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.