Den ons 17 aug. 2022 kl 16:23 skrev Patrik Karlström <[email protected]>:
> 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