简体   繁体   中英

Which design pattern does Java Swing use?

To be clear, I'm not asking which design pattern to use in my program. I'm asking which design pattern has been used in the creation of the Swing library and the event system used within it. I'm currently studying a Bachelor of Information Technology, and one of the trial exam questions asked me to describe the Event Model used in swing, and then went on to elaborate that the specific pattern used is the Chain of Responsibility design pattern. However, after doing some research, I stumbled across this article:

https://www.developer.com/java/data/understanding-and-using-the-java-delegation-event-model.html

Which states that from Java 1.1 onwards (and we're up to Java 8 now, almost Java 9), the approach to event handling was based on the "delegation event model" instead. However, while the article is dated November 9, 2016, it made me wonder about the validity of its content, hence the question here. I was hoping some more experienced programmers could give an up to date, and concrete answer.

如果我理解你的问题是正确的例如Action中使用的命令设计模式(javax.swing.Action)

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