简体   繁体   English

Jframe vs XML GUI

[英]Jframe vs xml GUI

Hey i am really new to this so sorry if this is a stupid question. 嘿,我真的很陌生,如果这是一个愚蠢的问题,请抱歉。 I created an android application and my goal is to make it into a PC application and i believe this to be possible without to much trouble since they can both be written in java. 我创建了一个android应用程序,我的目标是使其成为PC应用程序,并且我相信这是没有问题的,因为它们都可以用Java编写。

So my main question is in android application we used the XML files for the user interface. 所以我的主要问题是在android应用程序中,我们使用XML文件作为用户界面。 While in the pc application we would need to use jframes. 在pc应用程序中,我们将需要使用jframe。 I have been looking around im not sure if its parsing or i need something else i am very confused. 我一直在周围即时通讯不知道它的解析还是我需要其他东西,我很困惑。 i was hoping i can use the XML as a file which will create my user interface and my program would just be in the java files like a android application or is that not possible? 我希望我可以将XML用作将创建用户界面的文件,而我的程序将仅位于Java文件(如android应用程序)中,还是不可能? confused by what people have been saying about parsing, i checked out some examples and it just seems they just get some information from xml but dont use it for the actual layout. 由于人们对解析一直在说什么而感到困惑,我检查了一些示例,似乎他们只是从xml中获取了一些信息,但没有将其用于实际布局。

any help will be great. 任何帮助都会很棒。

I don't think that a conversion utility exists, and I don't believe that it would be easy or even reasonably possible since the library and use structure of Swing vs. Android is so different from each other. 我不认为存在转换实用程序,并且我也不认为它是容易甚至合理的,因为Swing与Android的库和使用结构彼此之间是如此不同。

What you need to do is to be sure that your program adheres strongly to an MVC (Model-View-Control) type of structure so that the same or similar model can be used in both programs. 您需要做的是确保您的程序严格遵循MVC(模型-视图-控件)类型的结构,以便在两个程序中都可以使用相同或相似的模型。 But again because the library and use structure of Swing vs. Android is so different I strongly believe that there is no way to share view or control code or to easily convert from one to another. 但是再次重申,由于Swing与Android的库和使用结构是如此不同,因此我坚信,无法共享视图或控制代码,也不能轻松地将它们彼此转换。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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