Aligning text in pieChart legend - How to right align the content inside the legend

☆樱花仙子☆ 提交于 2019-12-02 07:35:03

问题


As of now my legend is displayed like this

test1 5%
test2test2 10%
test2test2test3 85%


I am trying to display like this, with spaces and right aligned.

test1-------------------------5%
test2test2test2-----------10%
test3test3test3-----------85%

Any suggesstions appreciated


回答1:


You can use the approach shown here to create a separate panel containing your legend items. Give the panel a GridLayout(0, 1); specify JLabel.LEFT for the left column and JLabel.RIGHT for the right column. A complete example is shown here.



来源:https://stackoverflow.com/questions/28507357/aligning-text-in-piechart-legend-how-to-right-align-the-content-inside-the-leg

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