Skip to content

Commit dd18951

Browse files
Prevent Options dialog from closing when click Apply button
1 parent b1c4de2 commit dd18951

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatLafOptionsPanelController.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
import java.awt.Window;
2323
import java.beans.PropertyChangeListener;
2424
import java.beans.PropertyChangeSupport;
25+
import java.util.Arrays;
26+
import java.util.List;
27+
import java.util.stream.Collectors;
2528
import javax.swing.JComponent;
2629
import javax.swing.JDialog;
2730
import javax.swing.JFrame;
@@ -87,6 +90,8 @@ public void applyChanges() {
8790
JDialog.setDefaultLookAndFeelDecorated(isUseWindowDecorations);
8891
for (Window w : Window.getWindows()) {
8992
if (w.isDisplayable() && (w instanceof JFrame || w instanceof JDialog)) {
93+
List<Window> childs = Arrays.stream(w.getOwnedWindows())
94+
.filter(Window::isVisible).collect(Collectors.toList());
9095
w.dispose();
9196
if (w instanceof JFrame) {
9297
((JFrame) w).setUndecorated(isUseWindowDecorations);
@@ -98,6 +103,7 @@ public void applyChanges() {
98103
isUseWindowDecorations ? JRootPane.FRAME : JRootPane.NONE);
99104
}
100105
w.setVisible(true);
106+
childs.forEach(child -> child.setVisible(true));
101107
}
102108
}
103109
}

0 commit comments

Comments
 (0)