I'm working on an online game, which I am seriously considering writing a Java Applet for it. The game is not overly complex on the features. I'm considering at some point having at least 3 versions of the game, which include a Java stand alone, applet, and Android game. I know from Design Patterns that the best way to use differing things like buttons and the like is to use a Bridge interface, where I have a common template for the common buttons.

However, I'm having a bit of difficulty understanding what to do about the following. I know that Android programs use an Activity structure, which I am well familiar with, and that Applets extend the Applet interface, which I am not as familiar with. I also know that a stand alone java program uses basically a main() function, which doesn't have much structure. I'm convinced that there should be a way to design a common design pattern between the two, but somehow I'm missing what that is exactly. What can I do to make the different frameworks work with as much common code as possible?

  • 1
    Have a look at libgdx. It's a framework which lets you deploy your game to Android, Desktop and to a browser using WebGL.
    – Matsemann
    May 3, 2012 at 9:10

1 Answer 1


According to the answers to stackoverflow: recommended-ways-to-produce-app-portable-between-android-and-other-platforms the best way is

 keeping UI and biz logic / model separate

and writing seperate gui-s for android, applet, j2se, j2me.

But eaven keeping biz logic seperate is difficuilt because in the android world many api-s are based on the android Context which is the gateway to the operating system.

i have developped crossplatform biz logic for j2se and j2me for 2 projects. but i failed to do crossplatform for j2se/android because database and android-Context-api-s where to different from j2se.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.