Welcome to Dream.In.Code
Become a Java Expert!

Join 150,370 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,814 people online right now. Registration is fast and FREE... Join Now!




Calling native filechooser from java

 
Reply to this topicStart new topic

Calling native filechooser from java, Using native file choser from java

lordms12
16 Feb, 2008 - 01:06 PM
Post #1

D.I.C Regular
Group Icon

Joined: 16 Feb, 2008
Posts: 322



Thanked: 17 times
Dream Kudos: 225
My Contributions
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.
User is offlineProfile CardPM
+Quote Post

GWatt
RE: Calling Native Filechooser From Java
16 Feb, 2008 - 01:15 PM
Post #2

human inside
Group Icon

Joined: 1 Dec, 2005
Posts: 2,360



Thanked: 31 times
Dream Kudos: 500
My Contributions
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 Feb, 2008 - 01:15 PM
User is online!Profile CardPM
+Quote Post

lordms12
RE: Calling Native Filechooser From Java
16 Feb, 2008 - 01:42 PM
Post #3

D.I.C Regular
Group Icon

Joined: 16 Feb, 2008
Posts: 322



Thanked: 17 times
Dream Kudos: 225
My Contributions
QUOTE(GWatt @ 16 Feb, 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.


Can you be more clearer!

Thanks in advance

User is offlineProfile CardPM
+Quote Post

1lacca
RE: Calling Native Filechooser From Java
16 Feb, 2008 - 03:42 PM
Post #4

code.rascal
Group Icon

Joined: 11 Aug, 2005
Posts: 3,822



Thanked: 12 times
My Contributions
I would suggest using JNA (a simplified JNI), it might be easier, but I'm not sure how big the needed jars are.
User is offlineProfile CardPM
+Quote Post

lordms12
RE: Calling Native Filechooser From Java
16 Feb, 2008 - 04:04 PM
Post #5

D.I.C Regular
Group Icon

Joined: 16 Feb, 2008
Posts: 322



Thanked: 17 times
Dream Kudos: 225
My Contributions
QUOTE(1lacca @ 16 Feb, 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.


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
User is offlineProfile CardPM
+Quote Post

GWatt
RE: Calling Native Filechooser From Java
16 Feb, 2008 - 04:24 PM
Post #6

human inside
Group Icon

Joined: 1 Dec, 2005
Posts: 2,360



Thanked: 31 times
Dream Kudos: 500
My Contributions
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.
User is online!Profile CardPM
+Quote Post

1lacca
RE: Calling Native Filechooser From Java
16 Feb, 2008 - 04:30 PM
Post #7

code.rascal
Group Icon

Joined: 11 Aug, 2005
Posts: 3,822



Thanked: 12 times
My Contributions
QUOTE(lordms12 @ 17 Feb, 2008 - 01:04 AM) *

QUOTE(1lacca @ 16 Feb, 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.


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 smile.gif
Or just look on MSDN, I don't know by heart.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 02:24PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month