简体   繁体   中英

Swing Model View Presenter (MVP) example

I've been reading up on the MVP pattern, and have been unable to find a Java Swing code example. Does anyone know an opensource project that uses this pattern or where I could find such an example? (I'm not looking to use a framework to help implement the pattern, just an example.)

Actually, from a certain point of view, all of Swing can be seen as a MVP model( It really is turtles all the way down).

Models:
  ListModel, TableModel, etc.
Presenter:
  All Swing widgets, such as JLabel, JTable, JPanel etc.
View:
  ListUI, PanelUI, LayoutManagers, etc.

I've written several systems using MVP with Swing, JSP, and GWT, and have been extremely happy with the results each time.

After installing JDK (1.6 in this case) you can find all kind of demos in

"JDK instalation path"\\jdk1.6.0_29\\demo

and particularly in

C:\\Program Files (x86)\\Java\\jdk1.6.0_29\\demo\\jfc

you will find SwingApplet, SwingSet2 and SwingSet3 demos that allow to even see the code for the demo you choose to give it a try.

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