You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
2.0 KiB
67 lines
2.0 KiB
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;
|
|
|
|
|
|
/**
|
|
* 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<String> comboBox = new JComboBox<String>();
|
|
comboBox.setModel(new DefaultComboBoxModel<String>(new String[] {"", "Comic", "Horror", "Comedy", "Drama", "Action", "Thriller"}));
|
|
comboBox.setToolTipText("");
|
|
comboBox.setBounds(107, 100, 171, 22);
|
|
contentPane.add(comboBox);
|
|
|
|
JLabel lblDisplayTopMovie = new JLabel();
|
|
lblDisplayTopMovie.setForeground(Color.WHITE);
|
|
lblDisplayTopMovie.setFont(new Font("Tahoma", Font.PLAIN, 14));
|
|
lblDisplayTopMovie.setBounds(116, 145, 162, 24);
|
|
contentPane.add(lblDisplayTopMovie);
|
|
|
|
JButton btnOkTmg = new JButton("ok");
|
|
btnOkTmg.addActionListener(new ActionListener() {
|
|
public void actionPerformed(ActionEvent e) {
|
|
String genre=comboBox.getItemAt(comboBox.getSelectedIndex());
|
|
System.out.println("selected genre is " + genre);
|
|
Movie m = Database.findTopMovieByGenre(genre);
|
|
lblDisplayTopMovie.setText(m.getTitle());
|
|
|
|
}
|
|
});
|
|
btnOkTmg.setBounds(118, 180, 89, 23);
|
|
contentPane.add(btnOkTmg);
|
|
|
|
|
|
}
|
|
}
|