
import java.awt.Component;import java.awt.BorderLayout;import java.awt.Image;
import javax.swing.JApplet;import javax.swing.JPanel;import java.awt.FlowLayout;
import javax.swing.JRadioButton;import javax.swing.ButtonGroup;import java.awt.Font;
import java.awt.MediaTracker;import java.awt.event.*;
public class OOP_Video extends JApplet implements ActionListener{
JPanel middle;
	JPanel bottom;
	JRadioButton button1, button2, button3, button4, button5;
    MediaTracker mediaTracker;
    Image monsterCalls;
	Image CollateralBeauty;
	Image riseOfLegend;
	Image Incarnate;
	Image laLaLand;
    Image screen;
	public void init(){
		loadImages();
		setLayout(new BorderLayout());
		south();
		center();
	
	}
	public void start() {
		try {
			mediaTracker.waitForAll();
		} catch(Exception ex) {}
	}
	public void loadImages() {
		mediaTracker = new MediaTracker(this);//mmMMMMMMzzz
		monsterCalls = getImage(getCodeBase(), "a monster calls.jpg");
		CollateralBeauty = getImage(getCodeBase(), "collateral beauty.jpg");
		riseOfLegend = getImage(getCodeBase(), "incarnate.jpg");
		Incarnate = getImage(getCodeBase(), "la la land.jpg");
		laLaLand = getImage(getCodeBase(), "rise of the legend.jpg");
		screen = getImage(getCodeBase(), "screen.jpg");
		mediaTracker.addImage(screen, 1);
		mediaTracker.addImage(monsterCalls, 2);
		mediaTracker.addImage(CollateralBeauty, 3);
		mediaTracker.addImage(Incarnate, 4);
		mediaTracker.addImage(laLaLand, 5);
		mediaTracker.addImage(riseOfLegend, 6);
	}
	public void center() {
 		middle = new JPanel(new FlowLayout());
		add(middle, BorderLayout.CENTER);}
	public void south() {
		
		bottom = new JPanel(new FlowLayout());
		button1 = new JRadioButton("A Monster Calls");
		button2 = new JRadioButton("Collateral Beauty");
		button3 = new JRadioButton("Incarnate");
		button4 = new JRadioButton("La La Land");
		button5 = new JRadioButton("Rise Of The Legend");
		ButtonGroup grp = new ButtonGroup();
		grp.add(button1);
		grp.add(button2);
		grp.add(button3);
		grp.add(button4);
		grp.add(button5);
		button1.addActionListener(this);
		button2.addActionListener(this);
		button3.addActionListener(this);
		button4.addActionListener(this);
		button5.addActionListener(this);
		bottom.add(button1);
		bottom.add(button2);
		bottom.add(button3);
		bottom.add(button4);
		bottom.add(button5);
		add(bottom, BorderLayout.SOUTH);		
	}
	public void actionPerformed(ActionEvent e){
		middle.removeAll();     
		if (e.getSource() == button1) {
			Component movieA = new ScreenCurtain("A Monster Calls", "Directed by J. A. Bayona", 2017, monsterCalls, screen); 
			middle.add(movieA);
		}
		else if (e.getSource() == button2) {
			ScreenCurtain movieB = new ScreenCurtain("Collateral Beauty", "Directed by David Frankel", 2016, CollateralBeauty, screen);
			middle.add(movieB);
		}
		else if (e.getSource() == button3) {
			Component movieC = new ScreenCurtain("Incarnate", "Directed by Brad Peyton", 2016, Incarnate, screen);
			middle.add(movieC);
		}
		else if (e.getSource() == button4) {
			Component movieD = new ScreenCurtain("La La Land", "Directed by Damien Chazelle", 2016, laLaLand, screen);
			middle.add(movieD);
		}
		else if (e.getSource() == button5) {
			Component movieE = new ScreenCurtain("Rise Of The Legend", "Directed by Chow Hin Yeung Roy", 2014, riseOfLegend, screen);
			middle.add(movieE);	
		}
		validate();
		repaint();
	}
	
}
