RFR: 6955128: Spec for javax.swing.plaf.basic.BasicTextUI.getVisibleEditorRect contains inappropriate wording

Prasanta Sadhukhan psadhukhan at openjdk.org
Thu Jun 19 04:06:18 UTC 2025


On Thu, 19 Jun 2025 04:01:49 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java line 1033:
>> 
>>> 1031:     /**
>>> 1032:      * Gets the allocation to give the root View.
>>> 1033:      * The Rectangle returned has nothing to do with visibility but
>> 
>> "nothing to do with" ->  "unrelated to"
>> 
>> 
>> But what I'd really like to see is an explanation of what the return from this method ACTUALLY means / is used for.
>> What does "the allocation" mean ? Too woolly for me.
>
> getVisibleEditorRect() return the bounds of the text editor and the return value is used to to set-size/paint the 
> `javax.swing.text.View` of this text editor component.
> "the allocation" refers to what allocated area the view needs to paint, it seems to be a common phrase used in context of View class which says 
> 
>> "The view gets its allocation from the parent at paint time, so it must be prepared to redo layout if the allocated area is different from what it is prepared to deal with. "
> 
> In that regard, probably getAllocatedViewRect() would have been better choice of the method name

getVisibleEditorRect() return the bounds of the text editor and the return value is used to to set-size/paint the 
`javax.swing.text.View` of this text editor component.
"the allocation" refers to what allocated area the view needs to paint, it seems to be a common phrase used in context of View class which says 

> "The view gets its allocation from the parent at paint time, so it must be prepared to redo layout if the allocated area is different from what it is prepared to deal with. "

In that regard, probably getAllocatedViewRect() would have been better choice of the method name

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/25850#discussion_r2156051371


More information about the client-libs-dev mailing list