RFR: 8235404: [macos] JOptionPane blocks drawing string on another component

Harshitha Onkar honkar at openjdk.org
Fri Aug 2 00:26:31 UTC 2024


On Thu, 1 Aug 2024 23:19:35 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:

>> Currently if you try to use graphics to draw a string on a frame using JOptionPane + JTextField with a listener as a prompt, the string will not draw. Adding a repaint after dialog.dispose in JOptionPane will cause the text to show after the dialog is closed.
>
> test/jdk/javax/swing/JOptionPane/OptionPaneInput.java line 89:
> 
>> 87:         f.setVisible(true);
>> 88: 
>> 89:         JOptionPane.showMessageDialog(null, t);
> 
> Since parentComponent of JOptionPane is null running into NPE.
> 
> 
>         parentComponent.revalidate();
>         parentComponent.repaint();

The fix should handle both cases - when parentComponent is null and not null. With current fix, if there is a case when parentComponent is null, we will run into NPE.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20359#discussion_r1701040297


More information about the client-libs-dev mailing list