You don't add the BackgroundPane to the frame anywhere. The basic code for dynamically adding components is.
BackgroundPanel bp = new BackgroundPanel(bi); You don't add the BackgroundPane to the frame anywhere. The basic code for dynamically adding components is: panel. Add( someComponent ); panel.revalidate(); panel.repaint(); If you have already added the BackgroundPanel to the frame then you should be able to just invoke the setImage() method on the panel.So now you need to change your code to use ImageIO.
Read(...) to read in the image after you've selected the path from the file chooser.
– Warz Jul 19 at 14:46 You don't have to use an annonymous inner class for your listener. You can create a separate ActionListener class and pass in a reference to the BackgroundPanel when you create the class. Now your listener has access to the panel.
– camickr Jul 19 at 16:20.
Again, I don't see anywhere where you add the BackgroundPanel to the picturePanel JPanel. You will need to set the picturePanel's layout to BorderLayout and then add the BackgroundPanel, bp to the picturePanel in the BorderLayout. CENTER position, and then call revalidate and repaint as camickr shows you.
We also don't see the code for your BackgroundPanel class even though we've requested it. Again, I hope that you're drawing the image in its paintComponent method and using the proper drawImage overload, but til you show the code, we won't know for sure.
The background panel class is here (tips4java.wordpress. Com/2008/10/12/background-panel). Thanks for the help.
Can I do all of those mentioned steps right inside my button click action event method? – Warz Jul 19 at 15:34 @Warz: best to try it and find out. – Hovercraft Full Of Eels Jul 19 at 15:39 I have got the image correctly set in the background panel 'bp' and also added bp to my picturePanel as a component using the BorderLayout.
Center for a position and then called picturePanel. Revalidate and repaint afterwards but still unable to view the image. I have print statements showing the path is found and an image size is there.
– Warz Jul 21 at 2:07.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.