I'm new to Java and have just started making JFrame
s. I wrote a program for a game project I'm working on and would like help on where I can improve. I'm not new to programming, I also know HTML and Python well.
I believe one of the goals for all programmers is to make a useful/fun program as simple and short as possible.
I would like pointers/ideas/improvements for my Java program on how I can make it shorter, where I should aim for and how I can make it simpler.
package main;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
public class Game {
//Set Variables to make it easier for myself
public static double VER = 1.0;
public static String STATE = "ALPHA";
public static int WIDTH = 400;
public static int HEIGHT = 400;
public static int SCALE = 1;
public static void main(String [ ] args) {
//Create JFrame
JFrame launcher = new JFrame("Infinite Doom " + STATE + " " + VER);
launcher.pack();
//Settings for JFrame
launcher.setVisible(true);
launcher.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
launcher.setResizable(false);
launcher.setIconImage(new ImageIcon("Logo.png").getImage());
launcher.setSize(WIDTH, HEIGHT);
//Check Screen Res and centre window
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
launcher.setLocation(dim.width/2-launcher.getSize().width/2, dim.height/2-launcher.getSize().height/2);
}
}