Handling graphics and keyEvents in other classes?
I am making a game in Java as an applet. The game runs fine, but the code is growing larger as I'm implementing more features, so I'd like to orgainzationally branch off by putting code into other classes.
Now, I'm aiming to create a menu screen. I could add all of the necessary code to the same .java file, but it would be too bulky. What I'm trying to do is temporarily switch the flow of the class to another (we'll call it MenuScreen).
The tricky part is, this requires:
- Graphics handling (on the same applet)
- Another KeyListener for MenuScreen
- A thread of its own
How can I do this? I've been trying to accomplish this for over a week, and nothing seems to be working.
If more information would help finding an answer, I'll be happy to post parts-- or all--of the code. Any help or suggestions you can give me would be great. Thanks in advance.
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL