You are here

JFrame with JButtons and Adapters (

26 July, 2019 - 09:51
Available under Creative Commons-ShareAlike 4.0 International License. Download for free at
Note: Click here to view, 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.

Figure 6.2 Frame3