Commit f8c72057 authored by Roman Sedaikin's avatar Roman Sedaikin

Setup menu bar look and feel.

parent c58b2ea4
...@@ -40,12 +40,6 @@ fun createWindow(title: String) { ...@@ -40,12 +40,6 @@ fun createWindow(title: String) {
// Create menu. // Create menu.
val menuBar = JMenuBar() val menuBar = JMenuBar()
try {
System.setProperty("apple.laf.useScreenMenuBar", "true")
java.awt.Desktop.getDesktop().setDefaultMenuBar(menuBar)
} catch (e: UnsupportedOperationException) {
// Not all platforms allow this.
}
val menu = JMenu("File") val menu = JMenu("File")
menuBar.add(menu) menuBar.add(menu)
val menuItem = JMenuItem("Say Hello") val menuItem = JMenuItem("Say Hello")
......
...@@ -5,6 +5,7 @@ import java.io.InputStreamReader ...@@ -5,6 +5,7 @@ import java.io.InputStreamReader
import java.io.File import java.io.File
import java.nio.file.Files import java.nio.file.Files
import java.nio.file.StandardCopyOption import java.nio.file.StandardCopyOption
import javax.swing.UIManager
object Library { object Library {
private var loaded = false private var loaded = false
...@@ -45,5 +46,13 @@ object Library { ...@@ -45,5 +46,13 @@ object Library {
// 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")
// setup menu look and feel
try {
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