On Fri, 20 Jun 2025 03:36:33 GMT, Prasanta Sadhukhan <[email protected]>
wrote:
> It is passed to `View.setSize` also so just mentioning one may not be right…
Right. Both uses cases fall into the same category: the allocation controls the
size of the root view.
The returned allocation rectangle is also used in handling mutations to the
text model.
I'd rather leave it without any explanation why it's called *allocation*.
Anyone who dealt with Swing text components and their implementation of the
view classes is expected to roughly understand what allocation means. Searching
for usages of `getVisibleEditorRect` reveals the usages.
> `{@code allocation}` is a no-op as it is not a class..
Yes, it is an op: it refers to `allocation` the parameter of the `paint` method.
> Maybe we can mention "The returned rectangle is unrelated to visibility, and
> is used as an allocation parameter in javax.swing.text.View class to set the
> size and paint the allocated View"
If we stick to explaining *allocation*, your suggestion makes sense, I edited
it a bit: “The returned rectangle is unrelated to visibility, it is used to set
the size of the root view.” This is what it means… without going too deep into
the details.
We could add `@see` links to `View.paint` and/or `View.setSize`, the link to
paint could be the most useful because it has a parameter called `allocation`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25850#discussion_r2158735071