On Thu, 21 Mar 2024 03:13:45 GMT, Prasanta Sadhukhan <[email protected]> 
wrote:

>> test/jdk/javax/swing/JFrame/bug4419914.java line 71:
>> 
>>> 69:         frame.enableInputMethods(false);
>>> 70:         
>>> frame.getContentPane().setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
>>> 71:         frame.getContentPane().setLocale(Locale.ENGLISH);
>> 
>> The requirement to use getContentPane() has been obsolete since JDK 1.5 ...
>> here's an external page about it 
>> https://coderanch.com/t/345686/java/getContentPane
>> But I don't generally tell people to delete except here there are 9 calls 
>> cluttering up this code.
>> So not critical, but a suggestion.
>
> Thanks for the information, didn't know that..Updated....there is around ~400 
> occurrence of getContentPane() in swing tests in open still so probably 
> something to be optimised in future...

The tests were probably written before Java 5, even tests written later could 
still use `getContentPane` so that the test could be run with previous versions 
of Java. Yet it's irrelevant now.

The Java Tutorials have never been updated, [How to Make 
Frames](https://docs.oracle.com/javase/tutorial/uiswing/components/frame.html) 
uses `getContentPane` explicitly.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18390#discussion_r1533657135

Reply via email to