Skip to content

Commit 0047d46

Browse files
committed
OptionsLookAndFeel: refactor L&F refresh logic
1 parent 93ad2ab commit 0047d46

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/main/java/org/scijava/ui/swing/options/OptionsLookAndFeel.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,7 @@ public void run() {
101101

102102
@Override
103103
public void run() {
104-
// FIXME: Get all windows from UIService rather than just app.
105-
final UserInterface ui = uiService.getDefaultUI();
106-
final SwingApplicationFrame swingAppFrame =
107-
(SwingApplicationFrame) ui.getApplicationFrame();
108-
SwingUtilities.updateComponentTreeUI(swingAppFrame);
109-
swingAppFrame.pack();
104+
refreshSwingComponents();
110105
}
111106
});
112107
}
@@ -149,6 +144,18 @@ protected void initLookAndFeel() {
149144
lookAndFeelItem.setChoices(lookAndFeelChoices);
150145
}
151146

147+
// -- Helper methods --
148+
149+
/** Tells all known Swing components to change to the new Look & Feel. */
150+
private void refreshSwingComponents() {
151+
// FIXME: Get all windows from UIService rather than just app.
152+
final UserInterface ui = uiService.getDefaultUI();
153+
final SwingApplicationFrame swingAppFrame =
154+
(SwingApplicationFrame) ui.getApplicationFrame();
155+
SwingUtilities.updateComponentTreeUI(swingAppFrame);
156+
swingAppFrame.pack();
157+
}
158+
152159
// -- Deprecated methods --
153160

154161
@Deprecated

0 commit comments

Comments
 (0)