30 changed files with 146 additions and 540 deletions
Split View
Diff Options
-
BINFavorite_Movies/bin/Database.class
-
BINFavorite_Movies/bin/Main$1.class
-
BINFavorite_Movies/bin/Main.class
-
BINFavorite_Movies/bin/Main_HomePage$1.class
-
BINFavorite_Movies/bin/Main_HomePage$2.class
-
BINFavorite_Movies/bin/Main_HomePage$3.class
-
BINFavorite_Movies/bin/Main_HomePage$4.class
-
BINFavorite_Movies/bin/Main_HomePage.class
-
BINFavorite_Movies/bin/Movies$1.class
-
BINFavorite_Movies/bin/Movies$2.class
-
BINFavorite_Movies/bin/Movies.class
-
BINFavorite_Movies/bin/Ratings$1.class
-
BINFavorite_Movies/bin/Ratings.class
-
BINFavorite_Movies/bin/Star$1.class
-
BINFavorite_Movies/bin/Star.class
-
1Favorite_Movies/bin/files/data.txt
-
1Favorite_Movies/bin/files/ratings_data.txt
-
1Favorite_Movies/bin/files/star_data.txt
-
40Favorite_Movies/src/Database.java
-
1Favorite_Movies/src/Main.java
-
10Favorite_Movies/src/Main_HomePage.java
-
253Favorite_Movies/src/Movies.java
-
73Favorite_Movies/src/MoviesFrame.java
-
42Favorite_Movies/src/Rating.java
-
44Favorite_Movies/src/Ratings.java
-
34Favorite_Movies/src/RatingsFrame.java
-
8Favorite_Movies/src/ReadMe.txt
-
33Favorite_Movies/src/Star.java
-
124Favorite_Movies/src/StarsFrame.java
-
21ReadMe.txt
@ -1,2 +1,3 @@ |
|||
1,finding neemo,2016,01:56,Comic,Disney,sdf,neemo,5.6,2 |
|||
2,Lion King,2016,01:46,Animation,Disney,jk,LK,4.2,3 |
|||
1 gandara 2022 10 melody soju jay song 5.9 5 |
|||
@ -0,0 +1 @@ |
|||
1 jonny son 9 |
|||
@ -0,0 +1 @@ |
|||
1 gandara Jay 2022 |
|||
@ -1,8 +1,40 @@ |
|||
|
|||
import java.io.IOException; |
|||
import java.io.FileWriter; |
|||
|
|||
public class Database { |
|||
|
|||
void addMovie(Movie m){ |
|||
|
|||
} |
|||
public static void addMovie(Movie m){ |
|||
try { |
|||
|
|||
FileWriter fw = new FileWriter( "C:\\Users\\skc\\eclipse-workspace\\first\\Favorite_Movies\\src\\files\\data.txt",true); |
|||
fw.write(m.getMovieId()); |
|||
|
|||
fw.append(" ").write(m.getTitle()); |
|||
|
|||
} |
|||
fw.append(" ").write(m.getYear()); |
|||
|
|||
fw.append(" ").write(m.getLength()); |
|||
|
|||
fw.append(" ").write(m.getGenre()); |
|||
|
|||
fw.append(" ").write(m.getStudioName()); |
|||
|
|||
fw.append(" ").write(m.getProducerName()); |
|||
|
|||
fw.append(" ").write(m.getShortDescription()); |
|||
|
|||
fw.append(" ").write(String.valueOf(m.getAvgRating())); |
|||
|
|||
fw.append(" ").write(m.getNumWatched()); |
|||
|
|||
fw.write("\n"); |
|||
|
|||
fw.close(); |
|||
|
|||
} catch (IOException e1) { // TODO Auto-generated catch block |
|||
e1.printStackTrace(); } |
|||
|
|||
} |
|||
|
|||
} |
|||
@ -1,253 +0,0 @@ |
|||
import java.awt.BorderLayout; |
|||
import java.awt.EventQueue; |
|||
|
|||
import javax.swing.JFrame; |
|||
import javax.swing.JPanel; |
|||
import javax.swing.JTextField; |
|||
import javax.swing.border.EmptyBorder; |
|||
import javax.swing.table.DefaultTableModel; |
|||
import javax.swing.table.TableRowSorter; |
|||
|
|||
import java.awt.Color; |
|||
import javax.swing.JLabel; |
|||
import javax.swing.JOptionPane; |
|||
|
|||
import java.awt.Font; |
|||
import javax.swing.JButton; |
|||
import java.awt.event.ActionListener; |
|||
import java.io.FileWriter; |
|||
import java.io.IOException; |
|||
import java.awt.event.ActionEvent; |
|||
import java.awt.TextField; |
|||
import java.io.FileReader; |
|||
import java.io.FileWriter; |
|||
import java.io.Writer; |
|||
|
|||
|
|||
public class Movies extends JFrame { |
|||
|
|||
|
|||
private JPanel contentPane; |
|||
private JTextField tf_mid; |
|||
private JTextField tf_title; |
|||
private JTextField tf_year; |
|||
private JTextField tf_sname; |
|||
private JTextField tf_length; |
|||
private JTextField tf_genre ; |
|||
private JTextField tf_pname; |
|||
private JTextField tf_shortDesc; |
|||
private JTextField tf_avgrate; |
|||
private JTextField tf_num_watch; |
|||
|
|||
|
|||
|
|||
/** |
|||
* Create the frame. |
|||
*/ |
|||
public Movies() { |
|||
|
|||
//Object[] cols= {"Movie ID","Title","Year","Length","Genre","Studio Name","Producer Name","Short Description","Avg Ratings","Num Watched"}; |
|||
Object[] rows = new Object[10] ; |
|||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|||
setBounds(100, 100, 837, 639); |
|||
contentPane = new JPanel(); |
|||
contentPane.setBackground(new Color(0, 0, 51)); |
|||
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); |
|||
setContentPane(contentPane); |
|||
contentPane.setLayout(null); |
|||
|
|||
JPanel panel = new JPanel(); |
|||
panel.setBackground(new Color(0, 0, 51)); |
|||
panel.setBounds(10, 11, 801, 578); |
|||
contentPane.add(panel); |
|||
panel.setLayout(null); |
|||
|
|||
|
|||
|
|||
JLabel lblNewLabel = new JLabel("Movie Details"); |
|||
lblNewLabel.setBounds(273, 11, 160, 29); |
|||
lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 24)); |
|||
lblNewLabel.setForeground(new Color(255, 255, 255)); |
|||
panel.add(lblNewLabel); |
|||
|
|||
JLabel lblNewLabel_1 = new JLabel("Movie Id:"); |
|||
lblNewLabel_1.setFont(new Font("Tahoma", Font.PLAIN, 14)); |
|||
lblNewLabel_1.setForeground(Color.WHITE); |
|||
lblNewLabel_1.setBounds(31, 74, 109, 14); |
|||
panel.add(lblNewLabel_1); |
|||
|
|||
JLabel lblNewLabel_1_1 = new JLabel("Title:"); |
|||
lblNewLabel_1_1.setFont(new Font("Tahoma", Font.PLAIN, 14)); |
|||
lblNewLabel_1_1.setForeground(Color.WHITE); |
|||
lblNewLabel_1_1.setBounds(31, 110, 46, 14); |
|||
panel.add(lblNewLabel_1_1); |
|||
|
|||
JLabel lblNewLabel_1_2 = new JLabel("Year:"); |
|||
lblNewLabel_1_2.setFont(new Font("Tahoma", Font.PLAIN, 14)); |
|||
lblNewLabel_1_2.setForeground(Color.WHITE); |
|||
lblNewLabel_1_2.setBounds(31, 151, 46, 14); |
|||
panel.add(lblNewLabel_1_2); |
|||
|
|||
JLabel lblNewLabel_1_3 = new JLabel("Length:"); |
|||
lblNewLabel_1_3.setForeground(Color.WHITE); |
|||
lblNewLabel_1_3.setFont(new Font("Tahoma", Font.PLAIN, 14)); |
|||
lblNewLabel_1_3.setBounds(31, 187, 89, 23); |
|||
panel.add(lblNewLabel_1_3); |
|||
|
|||
JLabel lblNewLabel_1_3_1 = new JLabel("Genre:"); |
|||
lblNewLabel_1_3_1.setForeground(Color.WHITE); |
|||
lblNewLabel_1_3_1.setFont(new Font("Tahoma", Font.PLAIN, 14)); |
|||
lblNewLabel_1_3_1.setBounds(31, 233, 89, 23); |
|||
panel.add(lblNewLabel_1_3_1); |
|||
|
|||
JLabel lblNewLabel_1_3_2 = new JLabel("Studio Name:"); |
|||
lblNewLabel_1_3_2.setForeground(Color.WHITE); |
|||
lblNewLabel_1_3_2.setFont(new Font("Tahoma", Font.PLAIN, 14)); |
|||
lblNewLabel_1_3_2.setBounds(31, 281, 109, 23); |
|||
panel.add(lblNewLabel_1_3_2); |
|||
|
|||
JLabel lblNewLabel_1_3_3 = new JLabel("Producer Name:"); |
|||
lblNewLabel_1_3_3.setForeground(Color.WHITE); |
|||
lblNewLabel_1_3_3.setFont(new Font("Tahoma", Font.PLAIN, 14)); |
|||
lblNewLabel_1_3_3.setBounds(31, 328, 127, 23); |
|||
panel.add(lblNewLabel_1_3_3); |
|||
|
|||
JLabel lblNewLabel_1_3_4 = new JLabel("Short Description :"); |
|||
lblNewLabel_1_3_4.setForeground(Color.WHITE); |
|||
lblNewLabel_1_3_4.setFont(new Font("Tahoma", Font.PLAIN, 14)); |
|||
lblNewLabel_1_3_4.setBounds(31, 374, 149, 23); |
|||
panel.add(lblNewLabel_1_3_4); |
|||
|
|||
JLabel lblNewLabel_1_3_5 = new JLabel("Avg. Ratings:"); |
|||
lblNewLabel_1_3_5.setForeground(Color.WHITE); |
|||
lblNewLabel_1_3_5.setFont(new Font("Tahoma", Font.PLAIN, 14)); |
|||
lblNewLabel_1_3_5.setBounds(31, 424, 127, 23); |
|||
panel.add(lblNewLabel_1_3_5); |
|||
|
|||
JLabel lblNewLabel_1_3_6 = new JLabel("Num. Watched :"); |
|||
lblNewLabel_1_3_6.setForeground(Color.WHITE); |
|||
lblNewLabel_1_3_6.setFont(new Font("Tahoma", Font.PLAIN, 14)); |
|||
lblNewLabel_1_3_6.setBounds(31, 479, 127, 23); |
|||
panel.add(lblNewLabel_1_3_6); |
|||
|
|||
tf_mid = new JTextField(); |
|||
tf_mid.setBounds(231, 66, 222, 29); |
|||
panel.add(tf_mid); |
|||
|
|||
tf_title = new JTextField(); |
|||
tf_title.setBounds(231, 110, 222, 29); |
|||
panel.add(tf_title); |
|||
|
|||
tf_year = new JTextField(); |
|||
tf_year.setBounds(231, 151, 222, 29); |
|||
panel.add(tf_year); |
|||
|
|||
tf_length = new JTextField(); |
|||
tf_length.setBounds(231, 187, 222, 29); |
|||
panel.add(tf_length); |
|||
|
|||
tf_genre = new JTextField(); |
|||
tf_genre.setBounds(231, 233, 222, 29); |
|||
panel.add(tf_genre); |
|||
|
|||
tf_sname = new JTextField(); |
|||
tf_sname.setBounds(231, 281, 222, 29); |
|||
panel.add(tf_sname); |
|||
|
|||
tf_pname = new JTextField(); |
|||
tf_pname.setBounds(231, 328, 222, 29); |
|||
panel.add(tf_pname); |
|||
|
|||
tf_shortDesc = new JTextField(); |
|||
tf_shortDesc.setBounds(231, 378, 222, 29); |
|||
panel.add(tf_shortDesc); |
|||
|
|||
tf_avgrate = new JTextField(); |
|||
tf_avgrate.setBounds(231, 424, 222, 29); |
|||
panel.add(tf_avgrate); |
|||
|
|||
tf_num_watch = new JTextField(); |
|||
tf_num_watch.setBounds(231, 479, 222, 29); |
|||
panel.add(tf_num_watch); |
|||
|
|||
JLabel lblNewLabel_2 = new JLabel("Poster"); |
|||
lblNewLabel_2.setForeground(new Color(255, 255, 255)); |
|||
lblNewLabel_2.setBounds(549, 74, 222, 188); |
|||
panel.add(lblNewLabel_2); |
|||
|
|||
JButton btnHomeM = new JButton("Home"); |
|||
btnHomeM.addActionListener(new ActionListener() { |
|||
public void actionPerformed(ActionEvent e) { |
|||
Main_HomePage mhp=new Main_HomePage(); |
|||
mhp.setVisible(true); |
|||
if(mhp.isVisible()) { |
|||
//use to display only one screen |
|||
Movies.this.dispose(); |
|||
} |
|||
} |
|||
}); |
|||
btnHomeM.setBounds(425, 538, 89, 23); |
|||
panel.add(btnHomeM); |
|||
|
|||
JButton btnM_ok = new JButton("OK"); |
|||
btnM_ok.addActionListener(new ActionListener() { |
|||
public void actionPerformed(ActionEvent e) { |
|||
|
|||
if(tf_mid.getText().isEmpty() || tf_title.getText().isEmpty() || tf_year.getText().isEmpty() || tf_genre.getText().isEmpty() ||tf_num_watch.getText().isEmpty() || tf_avgrate.getText().isEmpty() || tf_pname.getText().isEmpty() || tf_sname.getText().isEmpty() || tf_shortDesc.getText().isEmpty() || tf_length.getText().isEmpty()) { |
|||
|
|||
JOptionPane.showMessageDialog(null, "Please Enter All the Fields !!"); |
|||
} |
|||
else { |
|||
/*rows[0] = tf_mid.getText(); |
|||
rows[1] = tf_title.getText(); |
|||
rows[2] = tf_year.getText(); |
|||
rows[3] = tf_length.getText(); |
|||
rows[4] = tf_genre.getText(); |
|||
rows[5] = tf_sname.getText(); |
|||
rows[6] = tf_pname.getText(); |
|||
rows[7] = tf_shortDesc.getText(); |
|||
rows[8] = tf_avgrate.getText(); |
|||
rows[9] = tf_num_watch.getText(); |
|||
model.addRow(rows);*/ |
|||
|
|||
try { |
|||
|
|||
FileWriter fw = new FileWriter("C:\\Users\\skc\\eclipse-workspace\\first\\Favorite_Movies\\src\\files\\data.txt",true); |
|||
tf_mid.write(fw); |
|||
tf_title.write(fw.append(",")); |
|||
tf_year.write(fw.append(",")); |
|||
tf_length.write(fw.append(",")); |
|||
tf_genre.write(fw.append(",")); |
|||
tf_sname.write(fw.append(",")); |
|||
tf_pname.write(fw.append(",")); |
|||
tf_shortDesc.write(fw.append(",")); |
|||
tf_avgrate.write(fw.append(",")); |
|||
tf_num_watch.write(fw.append(",")); |
|||
fw.write("\n"); |
|||
|
|||
fw.close(); |
|||
JOptionPane.showMessageDialog(null, "Movie added Successfully....."); |
|||
tf_mid.setText(""); |
|||
tf_title.setText(""); |
|||
tf_year.setText(""); |
|||
tf_length.setText(""); |
|||
tf_genre.setText(""); |
|||
tf_sname.setText(""); |
|||
tf_pname.setText(""); |
|||
tf_shortDesc.setText(""); |
|||
tf_avgrate.setText(""); |
|||
tf_num_watch.setText(""); |
|||
|
|||
} catch (IOException e1) { |
|||
// TODO Auto-generated catch block |
|||
e1.printStackTrace(); |
|||
} |
|||
|
|||
} |
|||
|
|||
} |
|||
}); |
|||
btnM_ok.setBounds(281, 538, 89, 23); |
|||
panel.add(btnM_ok); |
|||
} |
|||
} |
|||
@ -0,0 +1,42 @@ |
|||
|
|||
|
|||
public class Rating { |
|||
|
|||
private int movieId; |
|||
private String relation; |
|||
private int rating; |
|||
private String nameSurname; |
|||
|
|||
public int getMovieId() { |
|||
return this.movieId; |
|||
} |
|||
|
|||
public void setMovieId(int movieId) { |
|||
this.movieId = movieId; |
|||
} |
|||
|
|||
public String getRelation() { |
|||
return this.relation; |
|||
} |
|||
|
|||
public void setRelation(String relation) { |
|||
this.relation = relation; |
|||
} |
|||
|
|||
public int getRating() { |
|||
return this.rating; |
|||
} |
|||
|
|||
public void setRating(int rating) { |
|||
this.rating = rating; |
|||
} |
|||
|
|||
public String getNameSurname() { |
|||
return this.nameSurname; |
|||
} |
|||
|
|||
public void setNameSurname(String nameSurname) { |
|||
this.nameSurname = nameSurname; |
|||
} |
|||
|
|||
} |
|||
@ -1,44 +0,0 @@ |
|||
|
|||
|
|||
public class Ratings { |
|||
|
|||
private int MovieId; |
|||
private String Relation; |
|||
private int Rating; |
|||
private String NameSurname; |
|||
|
|||
|
|||
|
|||
|
|||
public int getMovieId() { |
|||
return MovieId; |
|||
} |
|||
public void setMovieId(int movieId) { |
|||
MovieId = movieId; |
|||
} |
|||
public String getRelation() { |
|||
return Relation; |
|||
} |
|||
public void setMovieTitle(String Relation) { |
|||
Relation = Relation; |
|||
} |
|||
public int getRating() { |
|||
return Rating; |
|||
} |
|||
public void setYear(int Rating) { |
|||
Rating = Rating; |
|||
} |
|||
public String getNameSurname() { |
|||
return NameSurname; |
|||
} |
|||
public void setNameSurname(String nameSurname) { |
|||
NameSurname = nameSurname; |
|||
} |
|||
|
|||
public void showHighRatedMovie() { |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
} |
|||
@ -1,8 +0,0 @@ |
|||
I have added 3 java files namely |
|||
MoviesFrame.java |
|||
StarsFrame.java |
|||
RatingsFrame.java |
|||
|
|||
also added text files in the files folder of 4 files |
|||
|
|||
in java file have set values for setter methods for all 3 modules and all 3 modules data will be saved in text files respectively |
|||
@ -1,34 +1,41 @@ |
|||
public class Star{ |
|||
|
|||
private int MovieId; |
|||
private String MovieTitle; |
|||
private int Year; |
|||
private String NameSurname; |
|||
private int movieId; |
|||
private String movieTitle; |
|||
private int year; |
|||
private String nameSurname; |
|||
|
|||
|
|||
public int getMovieId() { |
|||
return MovieId; |
|||
public int getMovieId() { |
|||
return this.movieId; |
|||
} |
|||
|
|||
public void setMovieId(int movieId) { |
|||
MovieId = movieId; |
|||
this.movieId = movieId; |
|||
} |
|||
|
|||
public String getMovieTitle() { |
|||
return MovieTitle; |
|||
return this.movieTitle; |
|||
} |
|||
|
|||
public void setMovieTitle(String movieTitle) { |
|||
MovieTitle = movieTitle; |
|||
this.movieTitle = movieTitle; |
|||
} |
|||
|
|||
public int getYear() { |
|||
return Year; |
|||
return this.year; |
|||
} |
|||
|
|||
public void setYear(int year) { |
|||
Year = year; |
|||
this.year = year; |
|||
} |
|||
|
|||
public String getNameSurname() { |
|||
return NameSurname; |
|||
return this.nameSurname; |
|||
} |
|||
|
|||
public void setNameSurname(String nameSurname) { |
|||
NameSurname = nameSurname; |
|||
this.nameSurname = nameSurname; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
Mac: |
|||
1. moved Readme.txt from src folder to top level |
|||
2. Fixed camelcase naming of attributes in Star.java |
|||
3. Renamed Ratings.java to Rating.java |
|||
4. Fixed camelcase naming of attributes in Rating.java |
|||
5. Implemented addMovie method in Database class |
|||
6. Called Database.addMovie in MoviesFrame |
|||
7. Made movie star and rating local variables in MoviesFrame StarsFrame RatingsFrame respectively |
|||
8. Compiled everything and resolved compilation issues |
|||
9. Deleted Movies.java |
|||
|
|||
|
|||
|
|||
I have added 3 java files namely |
|||
MoviesFrame.java |
|||
StarsFrame.java |
|||
RatingsFrame.java |
|||
|
|||
also added text files in the files folder of 4 files |
|||
|
|||
in java file have set values for setter methods for all 3 modules and all 3 modules data will be saved in text files respectively |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue