How to convert a java swing application to work on android

后端 未结 5 504
鱼传尺愫
鱼传尺愫 2020-12-04 20:23

So I built a program in Java using swing for the interface and i didn\'t realize how difficult it would be to convert it to be used as an android application. Is there any w

相关标签:
5条回答
  • 2020-12-04 20:32

    I did the same thing awhile back. Although there is no program out there that I know of to convert it directly. The Java code and the android code are very similar. Since android doesn't use swing's UI it uses XML based UI. once you get the UI functions of the android app down your Java code can be easily imported.

    I am working on converting my Java app into an android app now. Most of my classes imported with no problem.

    0 讨论(0)
  • 2020-12-04 20:42

    What I would do is that I would build the UI in XML, then I give the items an ID and reference to it in Java, and then I'll trigger everything by button clicks so what one button does in your swing layout does the same on android. You can't copy/paste it.

    0 讨论(0)
  • 2020-12-04 20:42
    • Open the project's properties

    • Select Java Build Path

    • Select Libraries tab

    From there you can Add External Jars and you can use swing layout

    0 讨论(0)
  • 2020-12-04 20:44

    AjaxSwing allows to convert Swing applications and use them directly on android or ipad, see http://www.creamtec.com/products/ajaxswing/solutions/java_swing_ui_on_ipad.html

    0 讨论(0)
  • 2020-12-04 20:50

    swing UI was meant for desktops and pc's but for android you have to use Xml then you can keep your java codes as they are in the various activities then use your event handling skills to trigger them

    0 讨论(0)
提交回复
热议问题