You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@netbeans.apache.org by Patrik Karlström <pa...@trixon.se> on 2022/12/09 18:04:31 UTC

Re: [FlatLAF] Initial value not fully set for NotifyDescriptor

Den ons 17 aug. 2022 kl 16:23 skrev Patrik Karlström <pa...@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

Re: [FlatLAF] Initial value not fully set for NotifyDescriptor

Posted by Patrik Karlström <pa...@trixon.se>.
The first mail is about a platform application and the second the IDE
itself.

Den lör 10 dec. 2022 00:06Eirik Bakke <eb...@ultorg.com> skrev:

> 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 <pa...@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 <pa...@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
>

RE: [FlatLAF] Initial value not fully set for NotifyDescriptor

Posted by Eirik Bakke <eb...@ultorg.com>.
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 <pa...@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 <pa...@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