I've noticed that DialogDisplayer.getDefault() returns a different 
implementation when run from a plain main() class (standalone Java application) 
than when run in the context of a NetBeans Platfrom application. The standalone 
implementation has some problems, like not enabling/disabling the OK button in 
response to NotifyDescriptor.setValid.

Is the behavior you are reporting for the NetBeans Platform application case, 
or the standalone Java app case?

-- Eirik

-----Original Message-----
From: Patrik Karlström <pat...@trixon.se> 
Sent: Friday, December 9, 2022 1:05 PM
To: dev@netbeans.apache.org
Subject: Re: [FlatLAF] Initial value not fully set for NotifyDescriptor

Den ons 17 aug. 2022 kl 16:23 skrev Patrik Karlström <pat...@trixon.se>:

> The initial value/default button for a dialog created with 
> NotifyDescriptor is not activated when using FlatLAF.
> There is an indication around the button requested to be default, but 
> also some remaining indicator around the actual default button.
>
> FlatLAF works fine when manually creating a dialog with 
> JOptionPane.showOptionDialog.
> MetalLAF works fine with NotifyDescriptor.
>
> The following code displays the problem.
> Uncomment to use the workaround.
>
>         var button1 = new JButton("1");
>         var button2 = new JButton("2");
>         var button3 = new JButton("3");
>         var buttons = new JButton[]{button1, button2, button3};
>
>         var d = new NotifyDescriptor(
>                 "Look at the buttons borders\nPress & hold ENTER",
>                 "Demo",
>                 DialogDescriptor.DEFAULT_OPTION,
>                 DialogDescriptor.WARNING_MESSAGE,
>                 buttons,
>                 button3
>         );
>
>         new Thread(() -> {
>             try {
>                 Thread.sleep(100);
>             } catch (InterruptedException ex) {
>                 Exceptions.printStackTrace(ex);
>             }
>
>             SwingUtilities.invokeLater(() -> {
>                 //button3.requestFocus();
>             });
>         }).start();
>
>         System.out.println(DialogDisplayer.getDefault().notify(d));
>
> Patrik
>


Now I notice this in NetBeans 16 too.
When trying to copy/paste a class from one project to another the refactor 
dialog shows up with four buttons:
Preview, Refactor, Cancel, Help

The Refactor button has the background of a focused button while the Cancel 
button has the border of a focused button.

Hitting enter equals Cancel.

The Metal LAF has a similar visual defect but the correct behavior when hitting 
enter.

Is this reproducible by anyone else?

Patrik

Reply via email to