用户界面通常是如何构建的?

发布于 2024-11-15 06:41:18 字数 136 浏览 4 评论 0原文

我有四个舱位的航班、乘客、座位表和候补名单。我正在尝试创建一个图形用户界面。我是摇摆新手,所以我不知道它是如何完成的。我应该为 gui 创建一个单独的类并在那里构建所有 gui,还是应该将我的 gui 代码合并到那些已经存在的类中?如果有一般准则,如何实施?

I have four classes flight, passenger, seating chart, and waiting list. I'm trying to create a gui. I am new to swing so I dont know how it is done. should I create a separate class for a gui and build all the gui there or should I incorporate my gui code in those already existing classes? how is it implemented if there is a general guideline?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

行至春深 2024-11-22 06:41:18

您提到的类是模型类;它们用于抽象系统的数据。您永远不应该将演示 [GUI] 代码放在模型类中。您的演示文稿必须有单独的类/代码[GUI]。

一般准则是:

独立的演示、控制器和
将代码模型化到不同的类中。使用
模型-视图-控制器设计
您的系统的模式。

The classes that you mention are model classes; they are used to abstract the data of your system. You should never put your presentation [GUI] code in model classes. You must have separate classes/code for your presentation[GUI].

The general guideline is that :

Separate Presentation, Controller and
Model code into different classes. Use
the model-view-controller design
pattern for your system.

蝶…霜飞 2024-11-22 06:41:18

在所有编程语言中,将 UI 和代码分开是很好的做法。更好地理解并保持代码干净。

In all programming languages is nice to separate UI and code. It's better to understand and keeps you code clean.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文