主要思想是使用Swing库绘制特定的表单(它将用于生成图像,该图像将被传输到escpos打印机,但这是另一个问题)。表单本身在顶部有一个全宽的容器,它代表标签。标签有一个自定义的字体,字体大小和可以有一个线条,因此我使用JTextPane。JTextPane元素和所有表单都将具有500px的固定大小。tp = new JTextPane(); Font font = new Fo
我有一个jTextPane和两个按钮add和undo。当我按下add按钮时,它在jTextPane中添加了一个新行。这是一个样本:
jTextPane1.getStyledDocument().insertString(jTextPane1.getDocument().getLength(), "\n New Item
我想在我的JTextPane中每6-7行之后画一条水平线,我正在使用StyledDocument并在运行时将字符串插入到我的JTextPane。我试过了textPane.setContentType("text/html");
textPane.setText("<html>Some Text Above The Line<hr size=5>So