How can I measure/calculate the size a Document needs to render itself?

后端 未结 3 2140
庸人自扰
庸人自扰 2020-11-28 15:34

I have a javax.swing.text.Document and I want to calculate the size of the bounding box that document needs to render itself.

Is that possible?

3条回答
  •  攒了一身酷
    2020-11-28 16:23

    The Document interface is a model for a text component, so the Document doesn't really have a boundary; but the View has a number of methods that "translate between the model and view coordinate systems." Depending on the goal, something there may help.

提交回复
热议问题