0

hi,

I would like to save a .bmp image using showSaveDialog and i cannot figure out what to use.. Below i have the code of open.

Code

protected void Open(JFileChooser chooser, JLabel lblPicture) {
		// TODO Auto-generated method stub
		if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
		{
			File fileChoosed = chooser.getSelectedFile();
			try 
			{
				imageChoosed = ImageIO.read(fileChoosed);
				lblPicture.setIcon(new ImageIcon(imageChoosed));	
				IconEnableing(true);
			} 
			
			catch (IOException e) 
			{
				e.printStackTrace();				
			}

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

3
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by xanawa
0

it saved but it saved as File not as an image.

What do you mean? Did it save but when you double click on the file in window it comes up with "Choose the program you wish to open this file with" dialog?

If that is the case make sure you have the file extension right. If you are saving it as a JPEG add the .jpg

0

What do you mean? Did it save but when you double click on the file in window it comes up with "Choose the program you wish to open this file with" dialog?

If that is the case make sure you have the file extension right. If you are saving it as a JPEG add the .jpg

thank you very much i figured out that when i was saving the image i did not write the extenstion after the name. thx

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.