Created
October 16, 2024 04:42
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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