Browse Source

added_wmf

master
pooja 3 years ago
parent
commit
e823ef9c6f
2 changed files with 81 additions and 0 deletions
  1. 7
      Favorite_Movies/src/Main_HomePage.java
  2. 74
      Favorite_Movies/src/WatchMovieFrame.java

7
Favorite_Movies/src/Main_HomePage.java

@ -172,6 +172,13 @@ public class Main_HomePage extends JFrame {
// upon entering a valid movie id and clicking the button // upon entering a valid movie id and clicking the button
// it should call Database.incNumWatched(movieId) // it should call Database.incNumWatched(movieId)
// This function will increase the number of times the movie with that id is watched in the file // This function will increase the number of times the movie with that id is watched in the file
WatchMovieFrame wm=new WatchMovieFrame();
wm.setVisible(true);
if(wm.isVisible()) {
//use to display only one screen
Main_HomePage.this.dispose();
}
} }
}); });

74
Favorite_Movies/src/WatchMovieFrame.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.JButton;
import javax.swing.JTextField;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import java.awt.Font;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class WatchMovieFrame extends JFrame {
private JPanel contentPane;
private JTextField tf_mid_wm;
/**
* Launch the application.
*/
/*public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
WatchMovieFrame frame = new WatchMovieFrame();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
*/
/**
* Create the frame.
*/
public WatchMovieFrame() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBackground(new Color(0, 0, 51));
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JButton btnOkWm = new JButton("ok");
btnOkWm.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Database.incNumWatched(Integer.parseInt(tf_mid_wm.getText()));
JOptionPane.showMessageDialog(null, "Movie Watch Number of Times Incremented successfully...");
}
});
btnOkWm.setBounds(61, 157, 89, 23);
contentPane.add(btnOkWm);
tf_mid_wm = new JTextField();
tf_mid_wm.setColumns(10);
tf_mid_wm.setBounds(59, 86, 210, 24);
contentPane.add(tf_mid_wm);
JLabel lblEnterMovieId = new JLabel("Enter Movie Id:");
lblEnterMovieId.setForeground(Color.WHITE);
lblEnterMovieId.setFont(new Font("Tahoma", Font.PLAIN, 14));
lblEnterMovieId.setBounds(59, 48, 162, 24);
contentPane.add(lblEnterMovieId);
}
}
Loading…
Cancel
Save