Java Forum / GUI / February 2007
How to show math equations in a GUI
stacey - 08 Feb 2007 22:52 GMT 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 - 08 Feb 2007 23:31 GMT > Hello everyone! > [quoted text clipped - 11 lines] > 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 - 09 Feb 2007 00:08 GMT > 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 [quoted text clipped - 6 lines] > > - 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,
Daniel Pitts - 09 Feb 2007 00:38 GMT > > 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 [quoted text clipped - 19 lines] > > Stacey, Look for a MathML rendering library for Java?
Andrew Thompson - 09 Feb 2007 06:57 GMT On Feb 9, 11:38 am, "Daniel Pitts" <googlegrou...@coloraura.com> wrote: ...
> > > 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 [quoted text clipped - 4 lines] > > > > While you can do what you want in pure Java, it won't be easy. ..
> > 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. ..
> Look for a MathML rendering library for Java? I have a different strategy that incorporates parts of both ideas.
1) Launch using web start (or include BrowserLauncher2 with your application) 2) Do the help pages in standard MathML* 3) Display the help pages in the user's own browser (using the web start services, or browser launcher, to show the help pages).
* <http://www.w3.org/Math/>
Andrew T.
Daniel Pitts - 09 Feb 2007 19:19 GMT > On Feb 9, 11:38 am, "Daniel Pitts" <googlegrou...@coloraura.com> > wrote: [quoted text clipped - 28 lines] > > Andrew T. Sounds like the way I'd go :-)
Stefan Schmiedl - 09 Feb 2007 12:12 GMT > 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 - 09 Feb 2007 14:56 GMT > 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. > [quoted text clipped - 8 lines] > > 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 - 09 Feb 2007 16:41 GMT > Hello everyone! > [quoted text clipped - 17 lines] > > 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 - 09 Feb 2007 20:32 GMT (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.
Free MagazinesGet 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 ...
|
|
|