import java.awt.*;
import java.awt.event.*;
import java.io.File;

import javax.swing.*;
import javax.swing.border.Border;

public class Movies {
	
	public static String[] filmPoster = new String[5];
	public static String[] film = new String[5];
	public static String[] filmInfo = new String[5];
	
	public static JPanel sinemaPaneli(int filmID) {
		
		String title = film[filmID];
		Border border = BorderFactory.createTitledBorder(title);
		
		JPanel sinema = new JPanel();
		sinema.setLayout(new FlowLayout());  // layout ayarlandi. setBounds'lar silindi
		sinema.setBorder(border);
		sinema.setBackground(new Color(153, 184, 191));
		
		ImageIcon posterImage = new ImageIcon("src/images/"+filmPoster[filmID]);
		JLabel labelPoster = new JLabel(posterImage);
		
		JLabel labelFilmIsmi = new JLabel();
		labelFilmIsmi.setText(film[filmID]);
		labelFilmIsmi.setFont(new Font("Helvetica", Font.BOLD, 21));
		
		JTextArea areaFilmCast = new JTextArea();
		areaFilmCast.setText(filmInfo[filmID]);
		areaFilmCast.setFont(new Font("Helvetica", Font.PLAIN, 17));
		
		JScrollPane areaScroll = new JScrollPane(areaFilmCast, 
				JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
		
		sinema.add(labelPoster);
	//	sinema.add(labelFilmIsmi);
	//	sinema.add(areaScroll);
		
		return sinema;
	}
	
	Movies() {
		
		filmPoster[0] = "poster_Blowback.jpg";
		filmPoster[1] = "poster_Cryo.jpg";
		filmPoster[2] = "poster_ILoveMyDad.jpg";
		filmPoster[3] = "poster_MyFavoriteGirlfriend.jpg";
		filmPoster[4] = "poster_ThorLoveAndThunder.jpg";
		
		film[0] = "Blowback";
		film[1] = "Cryo"; 
		film[2] = "I Love My Dad";
		film[3] = "My Favorite Girlfriend";
		film[4] = "Thor: Love And Thunder";
		
		filmInfo[0] = "Director\n"
				+ "    Tibor Takács\n"
				+ "\n"  // newLine
				+ "Writers\n"
				+ "    Kevin Yarris, Robert Edward Thomas, Matthew Eason, Robert Giardina\n"
				+ "\n"
				+ "Actors\n"
				+ "    Randy Couture, Louis Mandylor, Chris Maher, Benjamin Abiola, Michele Plaia, Texas Battle, Cam Gigandet\n"
				+ "\n"
				+ "Genre\n"
				+ "    Action and Adventure\n"
				+ "\n"
				+ "Run Time\n"
				+ "    1 hour 34 minutes";
		
		filmInfo[1] = "Director\n"
				+ "    Barrett Burgin\n"
				+ "\n"
				+ "Writers\n"
				+ "    Barrett Burgin, Mason D. Davis\n"
				+ "\n"
				+ "Actors\n"
				+ "    Jyllian Petrie, Mason D. Davis, Emily Marie Palmer, Morgan Gunter, Curt Doussett, Michael Flynn\n"
				+ "\n"
				+ "Genre\n"
				+ "    Science Fiction, Thriller\n"
				+ "\n"
				+ "Run Time\n"
				+ "    1 hour 58 minutes";
		
		filmInfo[2] = "Director\n"
				+ "    James Morosini\n"
				+ "\n"
				+ "Writers\n"
				+ "    James Morosini\n"
				+ "\n"
				+ "Actors\n"
				+ "    Patton Oswalt, James Morosini, Claudia Sulewski, Lil Rel Howery, Amy Landecker, Ricky Velez, Rachel Dratch\n"
				+ "\n"
				+ "Genre\n"
				+ "    Comedy\n"
				+ "\n"
				+ "Run Time\n"
				+ "    1 hour 36 minutes";
		
		filmInfo[3] = "Director\n"
				+ "    Amanda Raymond\n"
				+ "\n"
				+ "Writers\n"
				+ "    Amanda Raymond\n"
				+ "\n"
				+ "Actors\n"
				+ "    Bonnie Piesse, Tyler Johnson\n"
				+ "\n"
				+ "Genre\n"
				+ "    Romance, Comedy\n"
				+ "\n"
				+ "Run Time\n"
				+ "    2 hours 14 minutes";
		
		filmInfo[4] = "Director\n"
				+ "    Taika Waititi\n"
				+ "\n"
				+ "Actors\n"
				+ "    Chris Hemsworth, Christian Bale, Tessa Thompson, Taika Waititi, Natalie Portman\n"
				+ "\n"
				+ "Genre\n"
				+ "    Action and Adventure\n"
				+ "\n"
				+ "Run Time\n"
				+ "    1 hour 59 minutes";
		
		JFrame frame = new JFrame("073 JPnael FlowLayout JTextArea JScrollPnae");
		frame.setLayout(null);
		
		JPanel panel = new JPanel();
		panel.setLayout(new FlowLayout());
		panel.setPreferredSize(new Dimension(900,120)); // dimension ayarlandi
		panel.setBackground(new Color(106, 0, 0));
		
		JScrollPane levha = new JScrollPane(panel, 
				JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
		levha.setBounds(30,30,940,465);	// frame içindeki ölçüyü belirliyoruz.
		
		panel.add(sinemaPaneli(0));  // her eklnene film eklendigi sirada cikar.
		panel.add(sinemaPaneli(1));
		panel.add(sinemaPaneli(2));
		panel.add(sinemaPaneli(3));
		panel.add(sinemaPaneli(4));
		panel.add(sinemaPaneli(1));
		panel.add(sinemaPaneli(2));
		panel.add(sinemaPaneli(3));
		panel.add(sinemaPaneli(2));
		panel.add(sinemaPaneli(3));
		panel.add(sinemaPaneli(2));
		panel.add(sinemaPaneli(3));
		panel.add(sinemaPaneli(2));
		panel.add(sinemaPaneli(3));
		
		frame.add(levha);
		
		frame.setSize(1000,550);
		frame.getContentPane().setBackground(new Color(1, 64, 64));
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setLocationRelativeTo(null);
		frame.setResizable(false);
		frame.setVisible(true);
		
	}

}
