I\'m a .Net developer but somehow I was task to create a simple application in java for some extra reason. I was able to create that application but my problem is how can i cent
public class Example extends JFrame {
public static final int WIDTH = 550;//Any Size
public static final int HEIGHT = 335;//Any Size
public Example(){
init();
}
private void init() {
try {
UIManager
.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
SwingUtilities.updateComponentTreeUI(this);
Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
setSize(WIDTH, HEIGHT);
setLocation((int) (dimension.getWidth() / 2 - WIDTH / 2),
(int) (dimension.getHeight() / 2 - HEIGHT / 2));
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (UnsupportedLookAndFeelException e) {
e.printStackTrace();
}
}
}