JfileChooser won't show image selected inside Jpanel?

When dynamically removing/adding components the basic code should be.

When dynamically removing/adding components the basic code should be: panel. Add(...); panel.revalidate(); panel.repaint(); I don't know if this is the problem because you didn't post a SSCCE. Post a proper SSCCE if you need more help.

NEED HELP IN HOW TO MAKE IMAGE AUTOMATICALLY RESIZED), Then you can't use a JLabel. You need to do custom painting and use the Graphics. DrawImage(....) method.

You can take a look at the Background Panel which allows you to draw an image scaled or tiled (among other things).

I don't know of any other part of my code I could possibly post. You mentioned custom painting, is this creating a new class extending the Graphics class? If I have the panel size can I set the image size using the drawImage() method?

– Warz Jul 18 at 3:28 1 Did you read the SSCCE link? How is the code you posted compileable. How do we execute the code and click on a button since you never added the button to a frame?

I gave you an example of custom painting. Download the class and create a SSCCE that just uses that BackgroundPanel class with an image. Then you can follow the code to see how it works.

– camickr Jul 18 at 3:32 Okay, Thank you for the help. I created a test class and used the BackgroundPanel class to display and Image, here is the functionality I am trying to achieve following the same structure. I have a card-layout panel application and on that panel I have a button (upload image) that when clicked shows the FileChooser in a seperate Jframe.

Back in my application, I added a another JPanel (will replace with Background Panel) that is going to show the uploaded image. If there is any way I can show you a screenshot of this view please let me know. – Warz Jul 18 at 4:04 1 I don't understand the problem.

The BackgroundPanel class has a setImage() method so you can easily change the image once you read in the image after choosing a file. A screeshot doesn't help, that is why you need to post a SSCCE. – camickr Jul 18 at 4:15 I will re-create the error I am getting using a simple Frame and a Panel while adding the above button to my Frame.

Thanks – Warz Jul 18 at 17:42.

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.

Related Questions