首页>代码>23种设计模式的Java实现>/23种设计模式的Java实现/Adapter/src/TextShapeObject.java
/**
 *  The Object Adapter in this sample 
 */
public class TextShapeObject  implements Shape {
    private Text txt;
    public TextShapeObject(Text t) {
        txt = t;
    }
    public void Draw() {
        System.out.println("Draw a shap ! Impelement Shape interface !");
    }
    public void Border() {
        System.out.println("Set the border of the shap ! Impelement Shape interface !");
    }
    
    public void SetContent(String str) {
        txt.SetContent(str);
    }
    public String GetContent() {
        return txt.GetContent();;
    }

    public static void main(String[] args) {
        Text myText = new Text();
        TextShapeObject myTextShapeObject = new TextShapeObject(myText);
        myTextShapeObject.Draw();
        myTextShapeObject.Border();
        myTextShapeObject.SetContent("A test text !");
        System.out.println("The content in Text Shape is :" + myTextShapeObject.GetContent());
        
    }
}
最近下载更多
13112360  LV2 2021年12月23日
hyuga0410  LV2 2021年12月2日
zlldksk  LV1 2021年3月12日
larry0987  LV1 2020年11月20日
visrk123  LV1 2020年11月3日
luolukka  LV8 2020年8月8日
166027070  LV1 2020年3月25日
yuanjh2001  LV7 2020年3月25日
tootootoo  LV5 2020年1月18日
xindong  LV12 2020年1月9日
最近浏览更多
592132324  LV4 2023年12月5日
姜广坤  LV14 2023年1月5日
80730176  LV7 2022年12月15日
陈小灏  LV14 2022年5月19日
微信网友_5931535123124224  LV1 2022年5月3日
lz88888  LV11 2022年3月10日
为了水掉6位用户名  LV4 2022年3月4日
chen_jw  LV10 2021年12月25日
13112360  LV2 2021年12月23日
hyuga0410  LV2 2021年12月2日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友