Last active
August 29, 2015 14:09
-
-
Save erikgunawan/ff505865b22c3e4f2eb6 to your computer and use it in GitHub Desktop.
Mendapatkan Ukuran / Dimensi Layar menggunakan Java
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
import java.awt.GraphicsConfiguration; | |
import java.awt.GraphicsDevice; | |
import java.awt.GraphicsEnvironment; | |
import java.awt.Rectangle; | |
/** | |
* @Developer : Erik Gunawan | |
* @Nickname : EXz | |
* @Phone : 0896 5332 0577 | |
* @EMail : admin@erikgunawan.com | |
* @Gmail : erik.gunawan44@gmail.com | |
* @Website : www.erikgunawan.com | |
* @Facebook : facebook.com/revolutionist.exz | |
* @Twitter : twitter.com/_EXz | |
*/ | |
public class UkuranLayar { | |
public static void main(String[] args) { | |
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); | |
GraphicsDevice defaultScreenDevice = ge.getDefaultScreenDevice(); | |
GraphicsConfiguration[] gc = defaultScreenDevice.getConfigurations(); | |
Rectangle gcBounds = gc[0].getBounds(); | |
System.out.println("Dimensi Layar:" + gcBounds.getWidth() + " x " + gcBounds.getHeight()); | |
System.exit(0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment