Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 10 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(5)
这是一个非常好的示例 http://www.leepoint.net/GUI/struct/40mvc。 html 我试图找到最简单的可能让你感受到这个想法。
无论如何,我不喜欢:
您可以在各种不同的语言中使用 MVC、MVP 和整个其他模式。 Java 与 MVC 无关,只是 MVC 设计可以用 Java 编写。然而,有些框架嵌入了 MVC 架构并强制使用它。 Spring MVC 是最著名的 - 尝试找到更多关于它的信息,也许是一些教程。
Here is pretty nice example http://www.leepoint.net/GUI/structure/40mvc.html I tried to find simplest possible to let you feel the idea.
Anyway I don't like the:
You can use MVC, MVP and whole other patterns in various different languages. Java has nothing to do with MVC, except MVC design can be coded in Java. There are, however, some frameworks that have embedded MVC architecture and forces using it. Spring MVC is the most known - try to find more about it, maybe some tutorials.
模型 - 模型表示携带数据的对象或 JAVA POJO。如果数据发生变化,它还可以具有更新控制器的逻辑。
视图 - 视图表示模型包含的数据的可视化。
控制器 - 控制器作用于模型和视图。它控制进入模型对象的数据流,并在数据发生变化时更新视图。它将视图和模型分开。
mvc简单示例
Model - Model represents an object or JAVA POJO carrying data. It can also have logic to update controller if its data changes.
View - View represents the visualization of the data that model contains.
Controller - Controller acts on both Model and view. It controls the data flow into model object and updates the view whenever data changes. It keeps View and Model separate.
mvc simple example
请参阅此示例mvc简单示例,它将两个数字相加使用swings进行编程。通过这个例子你可以很容易地理解mvc的概念
see this example mvc simple example which is adding two numbers program using swings.by this example you can easily understud the concept of mvc
看一下 spring 框架,您也可以将它与 swing 一起使用,如 此教程。
Take a look at the spring framework, you can use it also with swing as shown in this tutorial .
下面的教程使用所谓的 Observer 和 Observable 类的 Java 内置功能,通过示例解释了 MVC 的概念。
带有观察者和可观察类的 MVC 示例
Using Javas in-built capabilities of the so called Observer and Observable classes the following tutorial explains the concept of MVC by an example.
MVC by Example with observer and observeable classes