package window;
import java.lang.*;
import java.net.*;
import java.awt.*;
import javax.swing.*;
public class Window {
private JFrame frame;
private JDesktopPane desktopPane;
public JPanel panel;
private JLabel backGround;
private Container container;
private GridLayout gridLayout;
public Window() {
frame=new JFrame();
desktopPane=new JDesktopPane();
panel=new JPanel();
backGround=new JLabel();
container=frame.getContentPane();
gridLayout=new GridLayout();
InitJFrame(new Dimension(780,780));
desktopPane.add(backGround,new Integer(Integer.MIN_VALUE));
desktopPane.add(panel);
panel.setLayout(gridLayout);
URL url=Window.class.getResource("BACKGROUND.PNG");
backGround.setIcon(new ImageIcon(url));
backGround.setHorizontalAlignment(SwingConstants.CENTER);
container.add(desktopPane);
gridLayout.setColumns(52);
gridLayout.setRows(52);
}
public void InitJFrame(Dimension windowSize) {
frame.setSize(windowSize.width,windowSize.height);
Toolkit kit=Toolkit.getDefaultToolkit();
Dimension screenSize=kit.getScreenSize();
frame.setLocation(screenSize.width/2-windowSize.width/2,screenSize.height/2-windowSize.height/2);
frame.setVisible(true);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}
}