Status: New

Comment #4 on issue 192 by atdixon: PStyledText breaks when using Insets and unconstrained width

I have a more specific analysis of this issue.

* You cannot setWidth() on a PStyledText until after you've given it a document (see PST.setBounds()). * You cannot setInsets() on a PStyledText if the inset values produce a total width margin greater than the width of the PStyledText. (Else you get the exception reported in this issue.)

To use insets with unconstrained width you must first set the document, then set the width, then set the insets:

        PStyledText t = new PStyledText();
        t.setDocument(new DefaultStyledDocument());
        t.setInsets(new Insets(10,10,10,10));

So it is possible to get the desired behavior, albeit awkward, undocumented construction.

I would thus not qualify this as a defect after all but I propose more robust semantics for future (2.0) behavior:

That is, I propose that PST allows for a width less than the provided insets with the result being a graceful layout degradation (single character per line which is what LineBreakMeasurer.nextLayout(0) produces) and not the LineBreakMeasurer exception we see above.

Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en

Reply via email to