This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes Starting small: Tic Tac Toe questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Starting small: Tic Tac Toe questions" Watch "Starting small: Tic Tac Toe questions" New topic

Starting small: Tic Tac Toe questions

Muro Zenigata

Joined: Aug 09, 2003
Posts: 2
Hey, guys. I completed my school's C++ course and now I'm moving on to Java. Not a difficult transition, though I do have some questions. I have the basics with the console down, but that's gotten boring and I would like to make a game. As this will be my first game I decided to do something relatively simple: Tic Tac Toe.
I have heard about Java's graphics abilites and how it is much easier than C++ and I must say that it is true.. I spent a few months last summer trying to learn the Win 32 API to make a graphical game but it was a pain in the butt. I researched Swing and have managed to use the JFrame to display my images, which I am storing in a JPanel. I am using the Image class to store my .jpg images. So far it's been coming along well. I load the images into a matrix of the Image type (3 by 3, like the real board). In the paintComponent function of my JPanel I draw all of the images. Everything loads correctly but when I explicity place an Image into the Images matrix it ends up in the wrong place.

Aside from that problem, I was wondering if this is a good way to go about building a graphics program. I plan to use all jpeg images.. I don't know anything fancy so I figured I'd just paint jpegs over jpegs and such. Has anyone else done simple graphical programs like this a different way?
Muro Zenigata

Joined: Aug 09, 2003
Posts: 2
Well, I figured out why the x and y numbers were switched.. when I drew the image I used x instead of y and it went over instead of down. I am still interested in other ways to do simple graphical programs, though.
Consider Paul's rocket mass heater.
subject: Starting small: Tic Tac Toe questions
Similar Threads
tic-tac-toe board
Turn Based Strategy Games
Game Tutorials -->> TicTacToe
HELP!! source code for tic tac toe game..
TicTacToe game