package com.betato.gamedisplay;

import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;

import javax.swing.JFrame;

public class Frame extends JFrame{
	private static final long serialVersionUID = 1L;
	
	private int width;
	private int height;
	
	public Frame(int width, int height, String title, boolean resizable, boolean fullscreen, boolean hideCursor) {
		this.width = width;
		this.height = height;
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setTitle(title);
		
		setSize(width, height);
		setResizable(resizable);
		if (fullscreen) {
			setUndecorated(true);
			setExtendedState(getExtendedState() | JFrame.MAXIMIZED_BOTH);
		}
		if (hideCursor) {
			setCursorHidden(true);
		}
	}
	
	public void setCursorHidden(boolean hideCursor){ 			
		if (hideCursor) { 			
			// Create a new blank cursor
			BufferedImage cursorImg = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
			Cursor blankCursor = Toolkit.getDefaultToolkit().createCustomCursor(
					cursorImg, new Point(0, 0), "blank cursor"); 			
			// Set the cursor
			getContentPane().setCursor(blankCursor);
		} else {
			// Set default cursor
			getContentPane().setCursor(Cursor.getDefaultCursor());
		}
	}
	
	public void setWindowSize(int width, int height) {
		// Update default size
		this.width = width;
		this.height = height;
		// Resize window
		setSize(width, height);
	}
	
	public void setContentSize(int width, int height) {
		// Set content size and pack
		getContentPane().setPreferredSize(new Dimension(width, height));
		pack();
		// Update default size
		width = getWidth();
		height = getHeight();
	}
}

@@ -282,51 +282,8 @@
 ;%0A%09%0A
-%09private int width;%0A%09private int height;%0A%09%0A
 %09pub
@@ -394,54 +394,8 @@
 ) %7B%0A
-%09%09this.width = width;%0A%09%09this.height = height;%0A
 %09%09se
@@ -1177,181 +1177,8 @@
 %7D%0A%09%0A
-%09public void setWindowSize(int width, int height) %7B%0A%09%09// Update default size%0A%09%09this.width = width;%0A%09%09this.height = height;%0A%09%09// Resize window%0A%09%09setSize(width, height);%0A%09%7D%0A%09%0A
 %09pub

Remove unused width and height from Frame