[java] please help a beginner set up a project

Started by
2 comments, last by XG08Zero 17 years, 5 months ago
Hey e1, Im writing a casino game in java. So far I've written 7 slot games that are all near completion . All will run as stand alone games. I want to bundle them all together so that it becomes one game. That way I can incorporate some sort of player progression that will transfer credits and so on from machine to machine. All that I have learned in school so far is how to make individual stand alone classes so my question to the board is how do I set up a menu that has JButtons, when pressed will open the slot that corresponds to the selection? Please keep in mind that I have never set up a project with multiple classes before so Im pretty ignorant to most of the lingo that goes with that. If it makes a difference, Im using JCreator.
Advertisement
I'm going to assume that your slot games are all based on JFrame or some such. You want to write another JFrame, with those buttons or menus or however you want to do it, and in the actionListener handling code you could then spawn your various games by making an instance of their class and making it visible, something like JFrame game1 = new MySlotGameXZY(); game1.setVisible();

It's a bit more involved than that but that should give you some ideas to get you started. What's important for this to work is that the various classes are on the classpath. The classpath is where the java VM looks for classes. There's a number of ways to ensure this, but what you probably want is to put all those compiled classes into the same package and then make a jar archive out of them. Google is your friend.

Thanks for the reply, your assumptions are right on (i should have put that in the origional post). I've tried what your suggestion was, creating a new JFrame and setting it visible after calling the class before I posted. I have not tried to mess with the class path. I guess that I was just under the assumption that JCreator took care of that when I put all my classes in what they call the workspace (not sure if that terminology is universal), that will be what I try next. If anyone can help me with some websites that cover setting up projects I would appreciate it. Not even my JCreators website gives help on how to set it up, and im having a little trouble finding it on the sun website.
Quote:Original post by Dr Spud
Thanks for the reply, your assumptions are right on (i should have put that in the origional post). I've tried what your suggestion was, creating a new JFrame and setting it visible after calling the class before I posted. I have not tried to mess with the class path. I guess that I was just under the assumption that JCreator took care of that when I put all my classes in what they call the workspace (not sure if that terminology is universal), that will be what I try next. If anyone can help me with some websites that cover setting up projects I would appreciate it. Not even my JCreators website gives help on how to set it up, and im having a little trouble finding it on the sun website.


haha- I use JCreator too. :P

Anyway, instead, I'd suggest using multiple JLabels. On my old version of my RPG, I realized that I could have the main display on JLabel, the buttons on another, and the stats like HP and stuff on another(which could be like total cash in your game) I'm not sure if I'm using the right terminology- maybe it was multiple JPanels- I can't remember. But I hope you know what I mean.

As for projects, I never really understood them well with JCreator so I never bothered. To my knowledge, creating a "project" in an IDE just neatly sorts the class files, source code, and other files- but doesn't really give you any extra benefits (This is to my limited knowledge though :P)
-----------------------AMD Sempron 3400+, 1.7Gb PC3200 RAM, PNY nVidia GeForce 7600GT Money Spent- $465.00runs FEAR at max settings! (1024x768)

This topic is closed to new replies.

Advertisement