简体   繁体   中英

How to convert a java swing application to work on android

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 way for me to easily convert or rebuilt the program to be sold in the android market place? If not can anyone point me toward any resources to help build a android.

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.

AjaxSwing允许转换Swing应用程序并直接在android或ipad上使用它们,请参阅http://www.creamtec.com/products/ajaxswing/solutions/java_swing_ui_on_ipad.html

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.

swing UI适用于桌面和PC,但对于Android,你必须使用Xml然后你可以保存你的java代码,因为它们在各种活动中然后使用你的事件处理技能来触发它们

  • 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM