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 :: how to change checkbox color in android 
Java :: java run cmd 
Java :: java print type of variable 
Java :: initialiser une arraylist 
Java :: java generate random integer in range 
Java :: string length in android studio java 
Java :: iterate hashmap java 
Java :: variables java 
Java :: string to int in java 
Java :: setupactionbarwithnavcontroller problem 
Java :: how to increase the size of array in java 
Java :: is a and has a relationship in java 
Java :: mockito verify more than once 
Java :: java read a line of input 
Java :: deserialize date java 
Java :: how to add a list in a list java 
Java :: java multiple catch blocks 
Java :: default parameters in java 
Java :: java check if path exists 
Java :: json array get json object 
Java :: min in java 
Java :: java date add hours 
Java :: his version of the Android Support plugin for IntelliJ IDEA (or Android Studio) cannot open this project, please retry with version 4.2 or newer. 
Java :: what is a do while loop in java 
Java :: how to compare strings java 
Java :: float java 
Java :: import android.support.v7.app.alertdialog androidx 
Java :: save bitmap file for share on android 10 
Java :: reversing the linked list 
Java :: findone in spring boot 2.4.1 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =