RFR: 8268145: [macos] Rendering artifacts is seen when text inside the JTable with TableCellEditor having JTextfield
Harshitha Onkar
honkar at openjdk.org
Wed Nov 27 18:54:42 UTC 2024
On Wed, 27 Nov 2024 16:22:49 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
> When a textfield is embedded in a TableCellEditor in a JTable in Aqua L&F and space is entered and caret moved back and forth by pressing left/right arrow button, an artifact is seen, which is basically the caret is not properly repainted leaving behind its trails.
>
> When caret is moved, it is repainted every time by "damaging" the area surrounding the caret to cause it to be repainted in a new location. AquaCaret overrides the default "damage" code to intersect the caret area with the border insets so that it does not damage the AquaBorder area..
> For TextField case, AquaTextFieldBorder insets is removed from AquaTextField and then intersected with AquaCaret to get the dirry region which is then repainted, so as to not damage the border but it is done irrespective of whether border is shown or not, so proper dirty region is not repainted leaving behind artifacts when the caret is moved around...
>
> Fix is to see if border to be painted is not opaque in which case the proper dirty region is calculated which is then used in repaint logic to repaint the component..
src/java.desktop/macosx/classes/com/apple/laf/AquaCaret.java line 209:
> 207: y = alloc.y;
> 208: width = alloc.width;
> 209: height = alloc.height;
Currently the test case tests the else branch (no border case), since the if branch is also modified, would it be better to test both cases - with and without border?
test/jdk/javax/swing/JTable/TestCaretArtifact.java line 51:
> 49: If artifact is seen, press Fail else press Pass.""";
> 50:
> 51: public static void main(String []args) throws Exception {
Suggestion:
public static void main(String[] args) throws Exception {
test/jdk/javax/swing/JTable/TestCaretArtifact.java line 68:
> 66: new Object[] {"1", "2"});
> 67:
> 68: JFrame frame = new JFrame();
JFrame title is missing
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22416#discussion_r1861119929
PR Review Comment: https://git.openjdk.org/jdk/pull/22416#discussion_r1861115321
PR Review Comment: https://git.openjdk.org/jdk/pull/22416#discussion_r1861115638
More information about the client-libs-dev
mailing list