Java Print API - Space character incorrectly printed using monospaced 'Courier New' font

笑着哭i 提交于 2019-12-05 06:32:29

I don't think you can fix this in the printing API.

First divide each line after the "green" digit into a left and (possibly empty) right substring.

In your JTextArea, use align to justify a two-column HTML table, as described in How to Use HTML in Swing Components.

As an alternative to JTextPane, use a GridLayout of JLabel. Give the left column RIGHT_ALIGNMENT and the right column LEFT_ALIGNMENT.

A two-column JTable, which uses JLabel for rendering, might be a third alternative. See How to Use Tables—Concepts: Editors and Renderers for details.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!