|
|
|
@ -18,22 +18,7 @@ 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. |
|
|
|
*/ |
|
|
|
@ -52,21 +37,29 @@ public class TopMovieFrame extends JFrame { |
|
|
|
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"})); |
|
|
|
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.getToolTipText().toString(); |
|
|
|
Database.findTopMovieByGenre(genre); |
|
|
|
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, 154, 89, 23); |
|
|
|
btnOkTmg.setBounds(118, 180, 89, 23); |
|
|
|
contentPane.add(btnOkTmg); |
|
|
|
|
|
|
|
|
|
|
|
|