Results 1 to 2 of 2
  1. #1
    aznbottle is offline Member
    Join Date
    Jun 2011
    Posts
    3
    Rep Power
    0

    Default how would i add icon to my save file?

    right now, i can save a file using JFileChooser, but how would i added an icon to the file that i saved?


    PHP Code:
    		fileChooser.addChoosableFileFilter(new CLVFilter());
    		int returnValue = fileChooser.showSaveDialog(frame);
    
    		if(returnValue == JFileChooser.APPROVE_OPTION){
    			try{
    				//filename consists of path
    				String filename = fileChooser.getSelectedFile().toString();
    				FileWriter fstream = new FileWriter(filename);
    				BufferedWriter out = new BufferedWriter(fstream);
    
    				out.write(SingleIntersection.this.getContentsOfObject());
    				out.close();
    						
    			}catch (Exception excep){//Catch exception if any
    				System.err.println("Error: " + excep.getMessage());
    			}
    		}

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    Files don't directly have icons, but the operating system can have icons associated with a file type. You would need to do this association through your OS, and possibly not via Java.

Similar Threads

  1. Netbeans6.8 .jar file icon change
    By avixt in forum AWT / Swing
    Replies: 3
    Last Post: 04-08-2011, 09:34 PM
  2. Icon on Jar file
    By justbeller in forum AWT / Swing
    Replies: 4
    Last Post: 03-18-2011, 08:04 PM
  3. How to set Icon on jar file
    By justbeller in forum AWT / Swing
    Replies: 6
    Last Post: 01-22-2011, 10:21 AM
  4. Change the icon of file in java
    By smn in forum SWT / JFace
    Replies: 18
    Last Post: 10-06-2010, 04:55 PM
  5. Replies: 0
    Last Post: 03-05-2010, 04:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •