Login page
This commit is contained in:
17
ChatApp/app/src/main/java/utilities/FxUtilities.java
Normal file
17
ChatApp/app/src/main/java/utilities/FxUtilities.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package utilities;
|
||||
|
||||
import javafx.stage.Screen;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class FxUtilities {
|
||||
public static void centerStage(Stage stage) {
|
||||
double screenWidth = Screen.getPrimary().getVisualBounds().getWidth();
|
||||
double screenHeight = Screen.getPrimary().getVisualBounds().getHeight();
|
||||
|
||||
double xPos = screenWidth / 2 - stage.getWidth() / 2;
|
||||
double yPos = screenHeight / 2 - stage.getHeight() / 2;
|
||||
|
||||
stage.setX(xPos);
|
||||
stage.setY(yPos);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user