How to show math equations in a GUI

Discussion in 'Java' started by stacey, Feb 8, 2007.

  1. stacey

    stacey Guest

    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
    stacey, Feb 8, 2007
    #1
    1. Advertising

  2. stacey

    Oliver Wong Guest

    "stacey" <> wrote in message
    news:...
    > 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
    Oliver Wong, Feb 8, 2007
    #2
    1. Advertising

  3. stacey

    stacey Guest

    > 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,
    stacey, Feb 9, 2007
    #3
  4. 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.
    Stefan Schmiedl, Feb 9, 2007
    #4
  5. stacey

    stacey Guest


    > 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.
    stacey, Feb 9, 2007
    #5
  6. stacey

    Rogan Dawes Guest

    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
    Rogan Dawes, Feb 9, 2007
    #6
  7. (I trimmed off half your four newsgroups.)
    > From: "stacey" <>
    > 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.
    robert maas, see http://tinyurl.com/uh3t, Feb 9, 2007
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. chirs
    Replies:
    18
    Views:
    737
    Chris Uppal
    Mar 2, 2004
  2. AciD_X
    Replies:
    4
    Views:
    8,062
    Jonathan Turkanis
    Apr 1, 2004
  3. Jeremy Watts

    math equations in java

    Jeremy Watts, May 21, 2008, in forum: Java
    Replies:
    17
    Views:
    2,542
    Andrew Thompson
    May 27, 2008
  4. Replies:
    3
    Views:
    288
  5. VK
    Replies:
    15
    Views:
    1,097
    Dr J R Stockton
    May 2, 2010
Loading...

Share This Page