mirror of
https://github.com/lov3b/Schack.git
synced 2025-02-23 12:10:07 +01:00
Only embed if supported
This commit is contained in:
parent
0bc66164f5
commit
c7231a572a
@ -23,7 +23,8 @@ public class Schack {
|
|||||||
try {
|
try {
|
||||||
// FlatSolarizedLightIJTheme.setup();
|
// FlatSolarizedLightIJTheme.setup();
|
||||||
FlatLightLaf.setup();
|
FlatLightLaf.setup();
|
||||||
System.setProperty("flatlaf.menuBarEmbedded", "true");
|
embedMenuBarIfSupported();
|
||||||
|
|
||||||
} catch (Exception cantThemeWithFlatLaf) {
|
} catch (Exception cantThemeWithFlatLaf) {
|
||||||
try {
|
try {
|
||||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||||
@ -85,7 +86,22 @@ public class Schack {
|
|||||||
|
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
new Schack();
|
new Schack();
|
||||||
new Schack();
|
}
|
||||||
|
|
||||||
|
private void embedMenuBarIfSupported() {
|
||||||
|
// Currently only supported in Windows 10+
|
||||||
|
String os = System.getProperty("os.name");
|
||||||
|
if (os.contains("Windows")) {
|
||||||
|
String versionNumberStr = os.split(" ")[1];
|
||||||
|
try {
|
||||||
|
int versionNumber = Integer.parseInt(versionNumberStr);
|
||||||
|
if (versionNumber >= 10) {
|
||||||
|
System.setProperty("flatlaf.menuBarEmbedded", "true");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user