To create a window, where all the elements of the game are draw, we use the window class of JPlay package.
The class constructor is as follows:
public Window(int width, int height);
In the place of "width" we put the value of the window width in pixels.
In the place of "height" we put the value of the window height in pixels.
Note: Everytime we create a game using JPlay,
we must first create a window and then, all the other components of the game.
This procedure is obligatory, if not made
several execution errors will occur.
Example: Create and display a borderless window with gray color
package Window;
import JPlay.Window;
/**
* @author Gefersom Cardoso Lima
* Federal Fluminense University - UFF - Brazil
* Computer Science
*/
public class Window001
{
//Creates and shows a gray window without borders.
//To quit press alt + F4
public static void main(String[] args)
{
//It creates a window with 800 pixels of width and 600 pixels of height
///This command always has to be the first to be executed.
Window window = new Window(800,600);
}
}