My games does not work on Mac but works in Windows

Recommended Posts

Edit: solution has been found. See the latest reply of this thread. The fix is to add the canvas to the jpanel before presenting the jframe object on the screen. Apparently, The Mac is more sensitive about this. If I flipped the order of the code around, it would still work in Windows but not in Mac. Interesting find.

See above. I just started using a Mac computer. I have no idea where to start.

Share on other sites

We're gonna need a bit more to go on here...

What do you mean when you say it "does not work"? Does it not compile? If not, what errors do you get that you don't understand? If it does compile, then does it not run? If not, how does it crash? Does it run mostly correctly except some small things are different? If so, what's different? What were you expecting?

Are you using a cross platform game engine that you expect to run on both Apple and Windows computers?

As a test, it complies. The frame window appears but it is all blank- no rendering. No problems is listed in Eclipse. I wrote this Java game for Windows and figured it would run the game in Mac but apparently not. No cross platform engine was used. I wrote my own animation system using standard Java libraries to render everything in the game. The rendering/drawing methods were provided by Standard Java.

Edited by warnexus

Share on other sites
Think different
(Sorry couldn't resist)

Share on other sites

Solution:

Okay I figured out what was going on.

panel.add(this);
frame.setVisible(true);


If I flipped the order of these two code, the game won't appear in Mac. However, if I changed the order in Windows, the game will appear. Interesting finding!

Apparently I have to add the canvas to the panel before I allow the frame to presents itself.

Holy cow! So many down votes...

Create an account

Register a new account

• Partner Spotlight

• Forum Statistics

• Total Topics
627637
• Total Posts
2978335

• 10
• 12
• 22
• 13
• 33