Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

how to center a window in java

public static void centreWindow(Window frame) {
    Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
    int x = (int) ((dimension.getWidth() - frame.getWidth()) / 2);
    int y = (int) ((dimension.getHeight() - frame.getHeight()) / 2);
    frame.setLocation(x, y);
}
Comment

PREVIOUS NEXT
Code Example
Java :: java verify string is hexadecimal 
Java :: button color xml 
Java :: android internet permission 
Java :: how to get date android studio 
Java :: how to converet negative byte value to postive int value in java 
Java :: install java 11 jdk raspberry pi 
Java :: java console colors 
Java :: how to compare 3 numbers in java 
Java :: java stop execution 
Java :: java compare two lists ignore case 
Java :: localdate to timestamp in java 
Java :: spring mvc get all request parameters 
Java :: close scanner java 
Java :: how to change top of window in java 
Java :: how to get path of captured image in android 
Java :: convert class to xml string 
Java :: leetcode patterns 
Java :: compare date with current date in android 
Java :: java code examples 
Java :: java coding standards variables 
Java :: transformez integer en string 
Java :: read csv java android 
Java :: static and final in java 
Java :: how to convert an ascii number to character in java 
Java :: how to make hello world in java 
Java :: public static void main(string args) 
Java :: .now() java 
Java :: spring boot hibernate log sql 
Java :: Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema 
Java :: sum of arraylist java 8 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =