How can I make a java FileDialog accept directories as its FileType in OS X?

前端 未结 3 1155
北恋
北恋 2020-12-07 01:39

I am trying to switch from using a JFileChooser to a FileDialog when my app is being run on a mac so that it will use the OS X file chooser. So far I have the following cod

3条回答
  •  爱一瞬间的悲伤
    2020-12-07 01:57

    I am trying to switch from using a JFileChooser to a FileDialog when my app is being run on a mac so that it will use the OSx file chooser

    I would suggest that you try to stay in the Swing world and shy away from the heavier-weight world of AWT. There are ways to work around issues with the Swing L&F on Macs, if that is what your problem is. Take a look at this post to an earlier question, which links to a site that shows how to get the correct Mac icons in the file chooser.

    Excuse me for not exactly answering your question. If there are other reasons why you would prefer to stay with FileDialog, I will gladly remove this post.

提交回复
热议问题