Skip to content

Instantly share code, notes, and snippets.

@erikgunawan erikgunawan/UkuranLayar
Last active Aug 29, 2015

Embed
What would you like to do?
Mendapatkan Ukuran / Dimensi Layar menggunakan Java
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
You can’t perform that action at this time.