Browse Source

fixed showposterimageframe

master
mac 3 years ago
parent
commit
d207bd48f1
3 changed files with 14 additions and 21 deletions
  1. BIN
      Favorite_Movies/bin/Main_HomePage.class
  2. 8
      Favorite_Movies/src/Main_HomePage.java
  3. 27
      Favorite_Movies/src/ShowPosterImageFrame.java

BIN
Favorite_Movies/bin/Main_HomePage.class

8
Favorite_Movies/src/Main_HomePage.java

@ -191,6 +191,14 @@ public class Main_HomePage extends JFrame {
// TODO 3: add a frame class to display a form
// this form will have a text field and an image control and button
// when a id is entered and the button is clicked, it should display the poster for that movie
ShowPosterImageFrame spif = new ShowPosterImageFrame();
spif.setVisible(true);
if(spif.isVisible()) {
//use to display only one screen
Main_HomePage.this.dispose();
}
}
});

27
Favorite_Movies/src/ShowPosterImageFrame.java

@ -24,22 +24,6 @@ public class ShowPosterImageFrame extends JFrame {
private JPanel contentPane;
private JTextField tf_mid_spi;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
ShowPosterImageFrame frame = new ShowPosterImageFrame();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
@ -69,12 +53,13 @@ public class ShowPosterImageFrame extends JFrame {
try {
BufferedImage myPicture;
JLabel lblPoster = new JLabel(new ImageIcon("c:\\tmp\\FavoriteMovies\\movies_poster\\poster1.jpg"));
lblPoster.setBounds(89, 160, 303, 150);
panel.add(lblPoster);
panel.validate();
panel.repaint();
myPicture = ImageIO.read(new File("C:\\Users\\skc\\eclipse-workspace\\first\\Favorite_Movies\\src\\images\\movies_poster\\Lion king\\81BMmrwSFOL.jpg"));
JLabel picLabel = new JLabel(new ImageIcon(myPicture));
add(picLabel);
} catch (IOException e1) {
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}

Loading…
Cancel
Save