Browse Source

topmovieFrame

master
pooja 3 years ago
parent
commit
1ddc3206bb
2 changed files with 84 additions and 0 deletions
  1. 10
      Favorite_Movies/src/Main_HomePage.java
  2. 74
      Favorite_Movies/src/TopMovieFrame.java

10
Favorite_Movies/src/Main_HomePage.java

@ -206,6 +206,16 @@ public class Main_HomePage extends JFrame {
// upon selecting a genre from a dropdown list and clicking the button
// it should call Database.findTopMovieByGenre(String genre)
// this function will search all the records in the file and find the top movies by genre
TopMovieFrame tmf=new TopMovieFrame();
tmf.setVisible(true);
if(tmf.isVisible()) {
//use to display only one screen
Main_HomePage.this.dispose();
}
}
}
});

74
Favorite_Movies/src/TopMovieFrame.java

@ -0,0 +1,74 @@
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.Color;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.DefaultComboBoxModel;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class TopMovieFrame extends JFrame {
private JPanel contentPane;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
TopMovieFrame frame = new TopMovieFrame();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public TopMovieFrame() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 467, 333);
contentPane = new JPanel();
contentPane.setBackground(new Color(0, 0, 51));
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel lblSelectGenre = new JLabel("Select Genre :");
lblSelectGenre.setForeground(Color.WHITE);
lblSelectGenre.setFont(new Font("Tahoma", Font.PLAIN, 14));
lblSelectGenre.setBounds(116, 45, 162, 24);
contentPane.add(lblSelectGenre);
JComboBox comboBox = new JComboBox();
comboBox.setModel(new DefaultComboBoxModel(new String[] {"", "Comic", "Horror", "Comedy", "Drama", "Action", "Thriller"}));
comboBox.setToolTipText("");
comboBox.setBounds(107, 100, 171, 22);
contentPane.add(comboBox);
JButton btnOkTmg = new JButton("ok");
btnOkTmg.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String genre=comboBox.getToolTipText().toString();
Database.findTopMovieByGenre(genre);
}
});
btnOkTmg.setBounds(118, 154, 89, 23);
contentPane.add(btnOkTmg);
}
}
Loading…
Cancel
Save