You are here

JFrame with JButtons and Adapters (Frame3.java)

26 July, 2019 - 09:51
Available under Creative Commons-ShareAlike 4.0 International License. Download for free at http://cnx.org/contents/402b20ad-c01f-45f1-9743-05eadb1f710e@37.6
Note: Click here to view Frame3.java, or download the entire archive

Figure 6.2 illustrates how to decouple the view from the rest of the world by having the view communicate to an interface called "adapter". A controller object, Frame3Controller connects the view Frame3 to the world by installing a concrete adapter into the view. The adapter is instantiated as anonymous inner object and has access to all of its outer object. The view does not and should not know anything about the world to which it is connected. This adds fexibility to the design.

media/image2.png
Figure 6.2 Frame3