开发者

Drawing formatted text

开发者 https://www.devze.com 2023-04-07 14:53 出处:网络
I set up a draw rectangle to draw simple formatted text first aligned to the left as *item 1 [1]Something

I set up a draw rectangle to draw simple formatted text first aligned to the left as

*item 1
    [1]Something
         content
    [2]Something else
         <a> subsomething else
             content
         <b> another subsomething else
             content
*item 2
    The end.

and I would also like it to automatically create a new column (after checking for the longest string in the first column [drawn stuff on the left hand side]) to draw the rest into it. In order to keep track of the paddings and itemized sections and subsections, I think of using a stack which I can push and pop the current and next positions needed to draw a text line each time I leave a content. Yet, I can't figure out how to jump back to a certain subsection position because stack doesn't offer an inline sub-scripting method. Then I look into a hash-map (in C# I have tried Dictionary) to keep track of it and to access the value via specific key. For that I also use a external global variable to maintain the number of subsections the user may have entered and increase开发者_高级运维 one each time a new subsection is created; and the float value is used to store the x-coordinate value for the drawstring to be done. This is complicated to me at least at present when I don't really have a nerve to go into it anymore. I can only receive false simulated outcomes.

So I am asking for an easier approach to tackle this problem, which I think is simple to many of you sure experiencing the same situation. I am desperately looking forward to seeing a short easy method to do this.


Draw formatted text using ..

..whatever works. I suggest a JLabel, which will render (simple) HTML/CSS formatted content.

See LabelRenderTest.java for an example.

Drawing formatted text

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号