java - The application automatically adds 10 pixels to width and height -


my question wierd, after searching , reading code 40 times, can't explain why jpanel , jframe gets additional 10 pixels width , height.

the code is:

public class game extends jpanel implements runnable {          public static final string name = "alpha !";          public static final int width = 600, height = 400;          public static void main(string[] args) {             game game = new game();             game.setminimumsize(new dimension(width, height));             game.setmaximumsize(new dimension(width, height));             game.setpreferredsize(new dimension(width, height));             game.setfocusable(true);             game.requestfocusinwindow();              jframe frame = new jframe(name);             frame.setdefaultcloseoperation(jframe.exit_on_close);              frame.setlayout(new borderlayout());             frame.add(game, borderlayout.center);             frame.pack();              frame.setresizable(false);             frame.setalwaysontop(true);             frame.setlocationrelativeto(null);              frame.setvisible(true);             game.startgame();         }          public void startgame() {             system.out.println("w " + getwidth() + ", h " + getheight());             new thread(this).start();         } } 

the println in startgame method prints:

w 610, h 410 

thanks in advance.

use frame.setundecorated(true) understand why there 10pxls increased in height , width.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -