public class HelperCompanion extends CompanionDecorator { @Override public void doSomething(){ super.doSomething(); System.out.print(" I am here to help you. "); } }
public class AffectiveCompanion extends CompanionDecorator { @Override public void doSomething(){ super.doSomething(); System.out.print(" I am here to cheer you."); } }
import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JLabel; public class AffectiveCompanion extends CompanionDecorator { @Override public void doSomething(JComponent panel){ super.doSomething(panel); ImageIcon face = new ImageIcon("src/cheer.png"); JLabel label = new JLabel(); label.setIcon(face); label.setHorizontalTextPosition(JLabel.CENTER); label.setVerticalTextPosition(JLabel.BOTTOM); label.setText("I am here to cheer you."); panel.add(label); } }
import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JLabel; public class HelperCompanion extends CompanionDecorator { @Override public void doSomething(JComponent panel){ super.doSomething(panel); ImageIcon face = new ImageIcon("src/bubble.png"); JLabel label = new JLabel(); label.setIcon(face); label.setHorizontalTextPosition(JLabel.CENTER); label.setVerticalTextPosition(JLabel.BOTTOM); label.setText("I am here to help you."); panel.add(label); } }
asu.edu Sum m er 2017 Disclaim er. These slides can only be used as study m aterial for the class C SE360 at ASU. They cannot be distributed or used for another purpose.