Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » how to set FileDialog's fileFilter?
how to set FileDialog's fileFilter? [message #446022] Tue, 16 November 2004 07:29 Go to next message
Eclipse UserFriend
Originally posted by: jyzhang.superv.com.cn

I want to add such a filter in fileDialog:
JPEG compressed image files(*.jpg, *.jpeg)

but there's only this method to access fileDialog,
fileDialog.setFileExtensions(String[])

this method will add two filters in fileDialog.
how to unify them as one?

who can help me, Thanks a lot.
Re: how to set FileDialog's fileFilter? [message #446025 is a reply to message #446022] Tue, 16 November 2004 08:54 Go to previous messageGo to next message
Robert Bacs is currently offline Robert BacsFriend
Messages: 165
Registered: July 2009
Senior Member
Hi,

With setFilterExtensions() you will set the extensions and with
setFilterNames() the correspondent filter names.

fileDialog.setFilterExtensions(new String[] {"*.jpg;*.jpeg"});
fileDialog.setFilterNames(new String[] {"JPEG images"});

If you need more filters just put the in the String array.

Regards,
Boby



"Harry Chang" <jyzhang@superv.com.cn> wrote in message
news:cnca96$p35$1@www.eclipse.org...
> I want to add such a filter in fileDialog:
> JPEG compressed image files(*.jpg, *.jpeg)
>
> but there's only this method to access fileDialog,
> fileDialog.setFileExtensions(String[])
>
> this method will add two filters in fileDialog.
> how to unify them as one?
>
> who can help me, Thanks a lot.
>
Re: how to set FileDialog's fileFilter? [message #446027 is a reply to message #446025] Tue, 16 November 2004 09:24 Go to previous message
Eclipse UserFriend
Originally posted by: jyzhang.superv.com.cn

HI,

thank you every much.
I have ever tried using ",", not ";". so I failed :(
fileDialog.setFilterExtensions(new String[] {"*.jpg,*.jpeg"});

thanks again, Regards
Harry


> Hi,

> With setFilterExtensions() you will set the extensions and with
> setFilterNames() the correspondent filter names.

> fileDialog.setFilterExtensions(new String[] {"*.jpg;*.jpeg"});
> fileDialog.setFilterNames(new String[] {"JPEG images"});

> If you need more filters just put the in the String array.

> Regards,
> Boby
Previous Topic:Table rightclick menu
Next Topic:DND support for SWT browser
Goto Forum:
  


Current Time: Tue Oct 27 16:43:03 GMT 2020

Powered by FUDForum. Page generated in 0.01918 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top