Browse Source

show movies for star

master
mac 3 years ago
parent
commit
1b758de56f
3 changed files with 14 additions and 6 deletions
  1. BIN
      Favorite_Movies/bin/Database.class
  2. 6
      Favorite_Movies/src/Database.java
  3. 14
      Favorite_Movies/src/ShowMoviesForStarFrame.java

BIN
Favorite_Movies/bin/Database.class

6
Favorite_Movies/src/Database.java

@ -25,10 +25,12 @@ public class Database {
while (scan.hasNext() && !found ) {
String line_ = scan.nextLine();
System.out.println("next: " + line_);
//System.out.println("next: " + line_);
if(line_.equals(username))
if(line_.equals(username)){
found = true;
break;
}
}
scan.close();
}

14
Favorite_Movies/src/ShowMoviesForStarFrame.java

@ -27,7 +27,7 @@ public class ShowMoviesForStarFrame extends JFrame {
*/
public ShowMoviesForStarFrame() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 378, 375);
setBounds(100, 100, 378, 300);
contentPane = new JPanel();
contentPane.setBackground(new Color(0, 0, 51));
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
@ -51,25 +51,31 @@ public class ShowMoviesForStarFrame extends JFrame {
ArrayList<Movie> movies = Database.findMoviesForStar(tf_starName.getText());
if (movies.size()>0)
{
JOptionPane.showMessageDialog(null, "Movies Found for Star!");
int i = 1;
String movieList = "";
for(Movie m: movies)
{
System.out.println("Adding movie: " + m.getTitle());
movieList += m.getTitle() + "\n";
JLabel nextMovie = new JLabel(m.getTitle());
nextMovie.setFont(new Font("Tahoma", Font.PLAIN, 14));
nextMovie.setForeground(new Color(255,255,255));
nextMovie.setBounds(66,160+(i*25),200,24);
int y = 10 + (i*25);
nextMovie.setBounds(20,y,200,24);
contentPane.add(nextMovie);
i++;
}
JOptionPane.showMessageDialog(null, movieList);
}
else {
JOptionPane.showMessageDialog(null, "Title not found !!");
}
}
});
btnOkSM.setBounds(68, 300, 89, 23);
btnOkSM.setBounds(68, 50, 89, 23);
contentPane.add(btnOkSM);
JButton btnHomeM = new JButton("Home");
@ -79,7 +85,7 @@ public class ShowMoviesForStarFrame extends JFrame {
if(mhp.isVisible()) {
//use to display only one screen
ShowMoviesForStarFrame.this.dispose(); } } });
btnHomeM.setBounds(168, 300, 89, 23);
btnHomeM.setBounds(168, 50, 89, 23);
contentPane.add(btnHomeM);
}
}
Loading…
Cancel
Save