Commit 8a345b27 authored by Roman Sedaikin's avatar Roman Sedaikin

Fixed MenuBar for Mac OS

parent 87e0a74f
...@@ -2,20 +2,39 @@ package org.jetbrains.skiko ...@@ -2,20 +2,39 @@ package org.jetbrains.skiko
import javax.swing.UIManager import javax.swing.UIManager
// object Setup {
// fun init(globalLAF: Boolean = false, noEraseBackground: Boolean = true) {
// if (noEraseBackground) {
// // we have to set this property to avoid render flickering.
// System.setProperty("sun.awt.noerasebackground", "true")
// }
// try {
// if (globalLAF) {
// // Setup menu look and feel.
// UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())
// System.setProperty("apple.laf.useScreenMenuBar", "true")
// }
// } catch (e: UnsupportedOperationException) {
// // Not all platforms allow this.
// }
// }
// }
object Setup { object Setup {
fun init(globalLAF: Boolean = false, noEraseBackground: Boolean = true) { fun init(globalLAF: Boolean = false, noEraseBackground: Boolean = true) {
if (noEraseBackground) { if (noEraseBackground) {
// we have to set this property to avoid render flickering. // we have to set this property to avoid render flickering.
System.setProperty("sun.awt.noerasebackground", "true") System.setProperty("sun.awt.noerasebackground", "true")
} }
try { when(hostOs) {
OS.MacOS -> {
System.setProperty("apple.laf.useScreenMenuBar", "true")
}
else -> {
if (globalLAF) { if (globalLAF) {
// Setup menu look and feel.
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()) UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())
System.setProperty("apple.laf.useScreenMenuBar", "true")
} }
} catch (e: UnsupportedOperationException) { }
// Not all platforms allow this.
} }
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment