我正在研究一个需要显示"奇特"方程式的Java小程序.MathML或LaTeX的Java渲染器是否是开源的?理想情况下,它将是一个不使用JNI的纯Java解决方案.
理想情况下,它还允许为生成的字形设置动画(例如,为等式的两边添加常量的动画,通过取消的术语的行等)
我有一个在Swing上完美运行的代码,但我想将它集成到javaFX上.我知道我必须使用SwingNode,但代码在javaFX中不起作用.这是我用的librarie的.jar:http://forge.scilab.org/index.php/p/jlatexmath/downloads/694/
这是摆动的结果:

这是Swing中的代码:
import org.scilab.forge.jlatexmath.TeXConstants;
import org.scilab.forge.jlatexmath.TeXFormula;
import org.scilab.forge.jlatexmath.TeXIcon;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
public class LatexExample extends JFrame implements ActionListener {
private JTextArea latexSource;
private JButton btnRender;
private JPanel drawingArea;
public LatexExample() {
this.setTitle("JLatexMath Example");
this.setSize(500, 500);
Container content = this.getContentPane();
content.setLayout(new GridLayout(2, 1));
this.latexSource = new JTextArea();
JPanel editorArea = new JPanel();
editorArea.setLayout(new BorderLayout());
editorArea.add(new JScrollPane(this.latexSource),BorderLayout.CENTER);
editorArea.add(btnRender = new JButton("Render"),BorderLayout.SOUTH);
content.add(editorArea);
content.add(this.drawingArea = new JPanel());
this.btnRender.addActionListener(this);
this.latexSource.setText("x=\\frac{-b \\pm \\sqrt {b^2-4ac}}{2a}"); …Run Code Online (Sandbox Code Playgroud)