Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #187

Re: Opening up a file wit

From "Thomas Hawtin" <thomas.hawtin@THRWHITE.remove-dii-this>
Subject Re: Opening up a file wit
Message-ID <4569a3e0$0$8746$ed2619ec@ptn-nntp-reader02.plus.net> (permalink)
Newsgroups comp.lang.java.gui
References <45698ec2$1_3@mk-nntp-2.news.uk.tiscali.com>
Date 2011-04-27 15:26 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
Mary Walker wrote:
> 
> Is it possible, in java, to open up a file (using the JFileChooser class) 
> and then execute it by telling JVM to use the default program.  For example 
> in windows, when I double click on a jpg file the image opens up in my 
> default graphics viewer - or if it has a .doc extension Microsoft word opens 
> it up.  What I'd like to do is write a Java GUI which can open up a file, 
> make changes to that file programatically and then allow the user to press a 
> button which views the modified file with it's default program. The files I 
> am modifying can be anything (i.e. images, word files, etc) so my java 
> program does not know which program to open the files up with.

1.6 has java.awt.Desktop.open(File)

http://download.java.net/jdk6/docs/api/java/awt/Desktop.html#open(java.io.File)

JDIC provides the equivalent API for 1.4 and later.

https://jdic.dev.java.net/

Tom Hawtin

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Find similar


Thread

Opening up a file with de "Mary Walker" <mary.walker@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000
  Re: Opening up a file wit "Thomas Hawtin" <thomas.hawtin@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000

csiph-web