- #1
TheMathNoob
- 189
- 4
Homework Statement
Java:
package myfirstgame;
import javax.swing.JFrame;
import java.awt.Graphics;
/**
*
* @author danif
*/
public class MyFirstGame extends JFrame {
public MyFirstGame()
{
setTitle("the game");
setSize(250,250);
setResizable(false);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void paint(Graphics g)
{
g.draw3DRect(WIDTH, WIDTH, WIDTH, WIDTH, rootPaneCheckingEnabled);
}
public static void main(String[] args) {
MyFirstGame game = new MyFirstGame();
}
}
Homework Equations
The Attempt at a Solution
It is kind of weird to me how paint executes without calling the function in the main. As soon as the object is created, paint is called. But paint is not static, so it is weird.
Last edited by a moderator: