//This is the gameloop.
//Sleep the game for a bit, make sure it doesn't run too fast.
//There are better ways of capping framerate, you shouldn't use this in a
//Add this to the frame.
//Create the buffer strategy - I'm using triple buffering here.
//Store this strategy for later
strat = getBufferStrategy();
//Do all of your drawing here.
//First, get an instance of a Graphics object -
Graphicsg = strat.getDrawGraphics();
//Do your drawing -
g.fillRect(0, 0, 640, 480);
g.fillRect(100, 100, 100,100);
//This will draw a blue rectangle of 100 pixels width and height, at the position 100 100.
//Remember to call this after drawing!!
//Create a frame
frame = newJFrame("Test");
//Make sure closing the frame closes the process!
//Create a new 'test' object.
Testt = newTest();
//Begin the game.
To highlight a line (yellow background), prefix it with '@@'
To indicate that a line should be removed (red background), prefix it with '-'
To indicate that a line should be added (green background), prefix it with '+'
To post multiple snippets, seperate them by '~~~~'
java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org