Results 1 to 19 of 19
  1. #1
    smn
    smn is offline Member
    Join Date
    Aug 2010
    Posts
    9
    Rep Power
    0

    Default Change the icon of file in java

    Hi,
    I created a file and i'm interested to add new image to the file for example adding tick image to the file. But i could not find any way to change the pic of file in directory. anyone can help me?

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default

    change the pic of file in directory
    Are you talking about how the OS represents a file in some directory contents viewing program?
    What java class are you using for this?

  3. #3
    smn
    smn is offline Member
    Join Date
    Aug 2010
    Posts
    9
    Rep Power
    0

    Default

    Hi,what i mean the pic of how OS represent the file, Actually I were looking at a program such as SVN, when checkout the source, one tick added to the file that OS represent and SVN also is a java program. That shows java may able to show folder with any pic (if I'm wrong pl correct me). That is why i wanted to learn to create a file but not with the normal pic, with any pic I interested for some purpose. the java class i'm using is AWT and SWING

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default

    java may able to show folder with any pic
    Are you talking about changing how the JFileChooser class displays folders and files?
    Or what class are you asking about?

  5. #5
    smn
    smn is offline Member
    Join Date
    Aug 2010
    Posts
    9
    Rep Power
    0

    Default

    If it is possible yes.
    For creating files i jz used File, but if JFileChooser can do so, would you pl guide me how to use?

  6. #6
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default

    I still don't understand what you are trying to do.
    What does creating files have to do with changing the icon associated with a file when that file's name is displayed in some program like JFileChooser or Windows Explorer.

  7. #7
    smn
    smn is offline Member
    Join Date
    Aug 2010
    Posts
    9
    Rep Power
    0

    Default

    The file Icon i'm interested to create is attached, hope that help. I would like to create a file but not with a pic, In SVN I've noticed after it checkout successfully, one tick icon added to the File pic in OS. That is what i'm interested to know and create. I wanna create a file with different pic in OS.

  8. #8
    smn
    smn is offline Member
    Join Date
    Aug 2010
    Posts
    9
    Rep Power
    0

    Default

    Sorry jz now attached
    Attached Thumbnails Attached Thumbnails Change the icon of file in java-file.jpg  

  9. #9
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default

    What program do you use to view the list of files that shows that icon/image with the file?
    Is it Windows Explorer? Or what?

  10. #10
    smn
    smn is offline Member
    Join Date
    Aug 2010
    Posts
    9
    Rep Power
    0

    Default

    The program I used is SVN, and yes it is window explorer that shows this type of ICON. SVN is a open source used to create a subversion of files existed in server, for that issue when Checkout, that icon appears in window explorer to show an successful checkout.

  11. #11
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default

    Sorry, I don't know anything about SVN. Does it use JNI?

  12. #12
    smn
    smn is offline Member
    Join Date
    Aug 2010
    Posts
    9
    Rep Power
    0

    Default

    I'm not sure,most probably yes, actually my question only is, if I want to create a folder in for example C directory of windows, can i create that folder with any icon(pic) i'm interested or java jz create the windows icon?

  13. #13
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default

    On windows XP, is it possible to change the icon displayed for an individual file?
    Do you know how to do it?
    For folders, the Properites context menu item will allow you to select an icon.

  14. #14
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,526
    Blog Entries
    7
    Rep Power
    20

    Default

    A FileView implementation can do what you want in a JFileChooser; read its API documentation.

    kind regards,

    Jos

  15. #15
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default

    Not sure that is what is being requested. Would FileView set the icon so that Windows Explorer and other file lists viewers would see that icon?

  16. #16
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,526
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by Norm View Post
    Not sure that is what is being requested. Would FileView set the icon so that Windows Explorer and other file lists viewers would see that icon?
    A FileView only works for JFileChoosers; otherwise a bit of native code (JNI) is needed. If a JFileChooser isn't it, ignore my previous reply please ;-)

    kind regards,

    Jos

  17. #17
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default

    Still trying to see what the OP wants.
    I thought he claimed that some program could set icons for individual files.

  18. #18
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,526
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by Norm View Post
    Still trying to see what the OP wants.
    I thought he claimed that some program could set icons for individual files.
    All I know is for Windows (Vista at least) icons are associated with extensions of files and directory types ... it can't be done in Java 1.6 (or older); maybe Java 1.7 can do it (but it isn't released yet). Linux isn't any different.

    kind regards,

    Jos

  19. #19
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default

    Yeah. That was what I thought, but I learn new things every day.
    Perhaps there is some run32dll call that will do the magic???

Similar Threads

  1. Can´t change selected/pressed Icon of a JMenu
    By Valhallon in forum AWT / Swing
    Replies: 3
    Last Post: 07-08-2011, 10:16 PM
  2. How to change JTree's node icon manually?
    By LeonLanford in forum AWT / Swing
    Replies: 3
    Last Post: 09-29-2010, 03:14 PM
  3. Swing: Change the icon on a JComponent
    By xytho33 in forum Advanced Java
    Replies: 1
    Last Post: 09-23-2010, 06:53 AM
  4. How to change Window Icon
    By sharafat in forum AWT / Swing
    Replies: 7
    Last Post: 01-15-2010, 12:37 AM
  5. Icon change and lib folder problem
    By LeonLanford in forum New To Java
    Replies: 10
    Last Post: 10-21-2009, 04:13 PM

Tags for this Thread

Posting Permissions

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