2017-09-15 100 views

回答

3

如果你想要做的是保存窗口的當前寬度/高度和恢復視圖時再次停靠,您可以覆蓋onDock做這兩個操作有:

override fun onDock() { 
    if (config["w"] != null && config["h"] != null) { 
     currentWindow?.apply { 
      width = config.double("w")!! 
      height = config.double("h")!! 
     } 
    } 

    currentWindow?.apply { 
     Bindings.add(widthProperty(), heightProperty()).onChange { 
      with (config) { 
       put("w", width.toString()) 
       put("h", height.toString()) 
       save() 
      } 
     } 
    } 
} 
相關問題