Forums Register Login

My first simple program, really need some pointers

+Pie Number of slices to send: Send
Ok this is my first simple program, I know its probs a bit wrong but its working. If anyone could point out how it could be done easier feel free to comment.
The program is taking inventory numbers and changing them, then writing to a jTable..
A few questions i do have is...

How would i go about Using each players Inventory in a different class or package...

How would i got about Adding a Jframe with a button that runs the program...

If any ways to simplify my code would be great thanks

Heres my code


+Pie Number of slices to send: Send
I would suggest separating the user interface code from the game logic. You should work on the game logic first using a simple text user interface. Then after you have the game logic in place and debugged, add the GUI on top of it.

Review your requirements. Nouns will become classes (e.g. 'Player'), and verbs will become methods. Look for noun relationships, such as a Game having two (or more) Players.

Your main() method should have very few lines of code in it. It should create object instances and use those to kick off the program.
+Pie Number of slices to send: Send
Thanks for the reply, ok when it come to moving the main how would i do it? where would i put it and how would i link it ?
+Pie Number of slices to send: Send
Here's a basic template:


For the time being put all your code in the same directory. Then you can go to that directory and do a "javac *.java". That will link everything together.
Grow a forest with seedballs and this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 416 times.
Similar Threads
JTable In JTree
JTable
JTable
Adding Column Dynamically to JTable
JTable: How to keep selected row visible after sort?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 13:34:26.