Calling native filechooser from java

Using native file choser from java

Page 1 of 1

6 Replies - 5969 Views - Last Post: 16 February 2008 - 05:30 PM Rate Topic: -----

#1 lordms12  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 30
  • View blog
  • Posts: 339
  • Joined: 16-February 08

Calling native filechooser from java

Posted 16 February 2008 - 02:06 PM

I would like to use native filechooser in a swing application

I am using swt for this now but I can not use 1.5Mb+ for this so I tried to remove the unnecessary classes to minimize the size but i just can get rid of .5Mb, is there another solution(I think that can done by JNI but i do not know much about)

Thanks in advance.
Is This A Good Question/Topic? 0
  • +

Replies To: Calling native filechooser from java

#2 GWatt  Icon User is offline

  • member icon

Reputation: 278
  • View blog
  • Posts: 3,079
  • Joined: 01-December 05

Re: Calling native filechooser from java

Posted 16 February 2008 - 02:15 PM

I'm sure there's a way to call a file open dialog with jni, but I the file opener I wrote took 4KB when compiled.

[edit] actually, it opened AND saved files.

This post has been edited by GWatt: 16 February 2008 - 02:15 PM

Was This Post Helpful? 0
  • +
  • -

#3 lordms12  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 30
  • View blog
  • Posts: 339
  • Joined: 16-February 08

Re: Calling native filechooser from java

Posted 16 February 2008 - 02:42 PM

View PostGWatt, on 16 Feb, 2008 - 02:15 PM, said:

I'm sure there's a way to call a file open dialog with jni, but I the file opener I wrote took 4KB when compiled.

[edit] actually, it opened AND saved files.


Can you be more clearer!

Thanks in advance
Was This Post Helpful? 0
  • +
  • -

#4 1lacca  Icon User is offline

  • code.rascal
  • member icon

Reputation: 44
  • View blog
  • Posts: 3,822
  • Joined: 11-August 05

Re: Calling native filechooser from java

Posted 16 February 2008 - 04:42 PM

I would suggest using JNA (a simplified JNI), it might be easier, but I'm not sure how big the needed jars are.
Was This Post Helpful? 0
  • +
  • -

#5 lordms12  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 30
  • View blog
  • Posts: 339
  • Joined: 16-February 08

Re: Calling native filechooser from java

Posted 16 February 2008 - 05:04 PM

View Post1lacca, on 16 Feb, 2008 - 04:42 PM, said:

I would suggest using JNA (a simplified JNI), it might be easier, but I'm not sure how big the needed jars are.


Sorry for bothering you again with this reply but i do try JNA but what is the native code i am suppossed to call

THNX
Was This Post Helpful? 0
  • +
  • -

#6 GWatt  Icon User is offline

  • member icon

Reputation: 278
  • View blog
  • Posts: 3,079
  • Joined: 01-December 05

Re: Calling native filechooser from java

Posted 16 February 2008 - 05:24 PM

I did mine as part of a sudoku solver, so it's pretty simplistic.
Anyway, I inherited from JFileChooser in the javax.swing package. If you have java 6 you can use FileNameExtensionFilter in conjunction with JFileChooser. IF you have java 5 or previous, just write your own name filter. It's pretty easy, and small. I'd post my code, except for the site policy. Sorry if that seems over cautious.
Was This Post Helpful? 0
  • +
  • -

#7 1lacca  Icon User is offline

  • code.rascal
  • member icon

Reputation: 44
  • View blog
  • Posts: 3,822
  • Joined: 11-August 05

Re: Calling native filechooser from java

Posted 16 February 2008 - 05:30 PM

View Postlordms12, on 17 Feb, 2008 - 01:04 AM, said:

View Post1lacca, on 16 Feb, 2008 - 04:42 PM, said:

I would suggest using JNA (a simplified JNI), it might be easier, but I'm not sure how big the needed jars are.


Sorry for bothering you again with this reply but i do try JNA but what is the native code i am suppossed to call

THNX


That's a Windows C/C++ question :)
Or just look on MSDN, I don't know by heart.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1