Skip to content

Instantly share code, notes, and snippets.

@petebankhead
Created October 16, 2024 04:42
Show Gist options
  • Save petebankhead/525e5d7adc9e280054fc4889886a1a67 to your computer and use it in GitHub Desktop.
Save petebankhead/525e5d7adc9e280054fc4889886a1a67 to your computer and use it in GitHub Desktop.
Quick Groovy script to get the location of a window in a JavaFX application
/**
* Quick Groovy script to get the location of a window in a JavaFX application.
* Originally posted at https://forum.image.sc/t/saving-window-layout/103763/3
* Written for QuPath v0.5.x
*/
import javafx.stage.Window
String title = "Brightness & contrast"
var window = Window.getWindows().find(w -> w.getTitle() == title)
if (window == null) {
println "No window found with title $title"
} else {
println([x: window.x, y: window.y, width: window.width, height: window.height])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment