Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

Read more of this post