Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #21 (permalink)  
Old 07-10-2008, 11:04 AM
Senior Member
 
Join Date: Jun 2008
Posts: 121
Sarinam is on a distinguished road
Quote:
Originally Posted by Eranga View Post
See, after few attempts you got the things. Now what you have to do is on menu item click event, do the same process. Do you know how to add events to menu items?
Hi I solve it..Thxs for help.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #22 (permalink)  
Old 07-10-2008, 11:06 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 4,609
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Nice to here that. If you solve the question, don't forget to mark the thread as solved.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #23 (permalink)  
Old 07-10-2008, 11:08 AM
Senior Member
 
Join Date: Jun 2008
Posts: 121
Sarinam is on a distinguished road
Quote:
Originally Posted by Eranga View Post
See, after few attempts you got the things. Now what you have to do is on menu item click event, do the same process. Do you know how to add events to menu items?
How can i make it browserebel.I mean when user click the menu then one dialog box is appear on the screen,which show drive name.

plz help me
Bookmark Post in Technorati
Reply With Quote
  #24 (permalink)  
Old 07-10-2008, 11:09 AM
Senior Member
 
Join Date: Jun 2008
Posts: 121
Sarinam is on a distinguished road
Quote:
Originally Posted by Eranga View Post
Nice to here that. If you solve the question, don't forget to mark the thread as solved.
Sir i will mark it but just ask a little problem.So tell me sir

Plz help me..
Bookmark Post in Technorati
Reply With Quote
  #25 (permalink)  
Old 07-10-2008, 11:11 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 4,609
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
You want to display a message box or a dialog? On any of them, simply call them in correct menu event. If you have done the previous work fine this couldn't be a difficult one at all.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #26 (permalink)  
Old 07-10-2008, 11:27 AM
Senior Member
 
Join Date: Jun 2008
Posts: 121
Sarinam is on a distinguished road
Quote:
Originally Posted by Eranga View Post
You want to display a message box or a dialog? On any of them, simply call them in correct menu event. If you have done the previous work fine this couldn't be a difficult one at all.
Sir i call dialog ..Here is code.But it is not working on the way.When i select the file name through dialog then it is not open..

Code:
public void actionPerformed(ActionEvent e) { try { FileDialog fd = new FileDialog ( new Frame ( ) , "Open file...", FileDialog.LOAD ) ; fd.setFile ( "*.log" ) ; fd.show ( ) ; Runtime.getRuntime().exec("cmd /c start c:\\"); } catch (Exception x) { x.printStackTrace(); } } }
Bookmark Post in Technorati
Reply With Quote
  #27 (permalink)  
Old 07-10-2008, 11:50 AM
Senior Member
 
Join Date: Jun 2008
Posts: 484
masijade is on a distinguished road
You don't need Runtime. And why did you not stick with JFileChooser rather than the older and not so good FileDialog?

Simply let the user choose a file with JFileChooser, then call Desktop.open(<file from filechooser>).

Once again, what is so hard. I mentioned the Desktop class in my very first post and provided a link to it and still, nowehere in any of your posted attempts, has it shown up anywhere. Do you always simply ignore what people tell you?
Bookmark Post in Technorati
Reply With Quote
  #28 (permalink)  
Old 07-10-2008, 12:25 PM
Senior Member
 
Join Date: Jun 2008
Posts: 121
Sarinam is on a distinguished road
Quote:
Originally Posted by masijade View Post
You don't need Runtime. And why did you not stick with JFileChooser rather than the older and not so good FileDialog?

Simply let the user choose a file with JFileChooser, then call Desktop.open(<file from filechooser>).

Once again, what is so hard. I mentioned the Desktop class in my very first post and provided a link to it and still, nowehere in any of your posted attempts, has it shown up anywhere. Do you always simply ignore what people tell you?
i am useing JDK 1.5.1.So i am not useing Desktop
Bookmark Post in Technorati
Reply With Quote
  #29 (permalink)  
Old 07-10-2008, 02:15 PM
Senior Member
 
Join Date: Jun 2008
Posts: 121
Sarinam is on a distinguished road
SIr plz tell me how can i do ..
Bookmark Post in Technorati
Reply With Quote
  #30 (permalink)  
Old 07-10-2008, 02:24 PM
Senior Member
 
Join Date: Jun 2008
Posts: 484
masijade is on a distinguished road
So switch out using Desktop.open with your Runtime stuff, using, however, the array command type, rather than the String command type (just don't forget to start it in a separate thread with an additional thread for both the command output and error streams otherwise it may hang if it produces any output), but still using the file returned from the JFileChooser.

But that was a piece of information that you should have spit out a bit earlier.
Bookmark Post in Technorati
Reply With Quote
  #31 (permalink)  
Old 07-10-2008, 02:39 PM
Senior Member
 
Join Date: Jun 2008
Posts: 121
Sarinam is on a distinguished road
Quote:
Originally Posted by masijade View Post
So switch out using Desktop.open with your Runtime stuff, using, however, the array command type, rather than the String command type (just don't forget to start it in a separate thread with an additional thread for both the command output and error streams otherwise it may hang if it produces any output), but still using the file returned from the JFileChooser.

But that was a piece of information that you should have spit out a bit earlier.
ok sir what information i spit out.Can you give me these information..
Bookmark Post in Technorati
Reply With Quote
  #32 (permalink)  
Old 07-10-2008, 03:06 PM
Senior Member
 
Join Date: Jun 2008
Posts: 484
masijade is on a distinguished road
Quote:
Originally Posted by Sarinam View Post
ok sir what information i spit out.Can you give me these information..
The fact that you were using 1.5

We can only advise you on things that we are aware of. If we advise you to use a Class from 1.6 that does not exist in 1.5, and you are using 1.5, but don't say anything, than all we do is run around in circles with us repeating what we've already said, and you continually running down dead ends and coming back complaining.

On your second post you should have said "I'm using 1.5" rather than waiting until just now to do so.
Bookmark Post in Technorati
Reply With Quote
  #33 (permalink)  
Old 07-10-2008, 03:22 PM
Senior Member
 
Join Date: Jun 2008
Posts: 121
Sarinam is on a distinguished road
Quote:
Originally Posted by masijade View Post
The fact that you were using 1.5

We can only advise you on things that we are aware of. If we advise you to use a Class from 1.6 that does not exist in 1.5, and you are using 1.5, but don't say anything, than all we do is run around in circles with us repeating what we've already said, and you continually running down dead ends and coming back complaining.

On your second post you should have said "I'm using 1.5" rather than waiting until just now to do so.
Ok sir,one thing i want to know what can i change in this code for run perfect.I mean according to need..Code is here

Code:
public void actionPerformed(ActionEvent e) { FileDialog fd = new FileDialog ( new Frame ( ) , "Log", FileDialog.LOAD ) ; fd.setFile ( "*.log" ) ; fd.show ( ) ; try { Runtime.getRuntime().exec("cmd /c start \\"); } catch (Exception x) { x.printStackTrace(); } }
Plz help me Sir
Bookmark Post in Technorati
Reply With Quote
  #34 (permalink)  
Old 07-10-2008, 03:32 PM
Senior Member
 
Join Date: Jun 2008
Posts: 484
masijade is on a distinguished road
Use JFileChooser, not FileDialog. And execute the proper command in the runtime exec method (and use the array form of it, not the string form, otherwise a file with a space in the name is going to mess it up).

See

JFileChooser (Java 2 Platform SE 5.0)
Runtime (Java 2 Platform SE 5.0)
How to Use File Choosers (The Java™ Tutorials > Creating a GUI with JFC/Swing > Using Swing Components)
When Runtime.exec() won't - Java World
Bookmark Post in Technorati
Reply With Quote
  #35 (permalink)  
Old 07-10-2008, 04:01 PM
Senior Member
 
Join Date: Jun 2008
Posts: 121
Sarinam is on a distinguished road
Quote:
Originally Posted by masijade View Post
Use JFileChooser, not FileDialog. And execute the proper command in the runtime exec method (and use the array form of it, not the string form, otherwise a file with a space in the name is going to mess it up).

See

JFileChooser (Java 2 Platform SE 5.0)
Runtime (Java 2 Platform SE 5.0)
How to Use File Choosers (The Java™ Tutorials > Creating a GUI with JFC/Swing > Using Swing Components)
When Runtime.exec() won't - Java World
Sir it's a good but i don't get any good example.I know what you think about me but it's a fact sir.Plz help me
Bookmark Post in Technorati
Reply With Quote
  #36 (permalink)  
Old 07-11-2008, 08:06 AM
Senior Member
 
Join Date: Jun 2008
Posts: 121
Sarinam is on a distinguished road
Quote:
Originally Posted by Sarinam View Post
Sir it's a good but i don't get any good example.I know what you think about me but it's a fact sir.Plz help me
Sir plz help me..i am stuck here..
Bookmark Post in Technorati
Reply With Quote
  #37 (permalink)  
Old 07-11-2008, 04:06 PM
Senior Member
 
Join Date: Jun 2008
Posts: 121
Sarinam is on a distinguished road
Quote:
Originally Posted by masijade View Post
Use JFileChooser, not FileDialog. And execute the proper command in the runtime exec method (and use the array form of it, not the string form, otherwise a file with a space in the name is going to mess it up).

See

JFileChooser (Java 2 Platform SE 5.0)
Runtime (Java 2 Platform SE 5.0)
How to Use File Choosers (The Java™ Tutorials > Creating a GUI with JFC/Swing > Using Swing Components)
When Runtime.exec() won't - Java World

Sir now i am open file directly from directory..

Code:
Runtime.getRuntime().exec("cmd /c start \\");
through this ,it is open a directori.

But i want to open a some specific path like "\\Program Files\\Internet Explorer" then i am geting error. So how can i set the set.

Plz help me
Bookmark Post in Technorati
Reply With Quote
  #38 (permalink)  
Old 07-11-2008, 04:44 PM
Senior Member
 
Join Date: Jun 2008
Posts: 484
masijade is on a distinguished road
Oh come on. Do you know what program you have to use to view a "chm" file (whatever the heck that is)?

If so, use that programs executable as the command with the file returned from JFileChooser as an argument, instead of "start \\" in that exec statement.

And use the form of the exec method that takes an array rather than a string (and those links I posted earlier have more than enough info for you to figure out how to use that).

If you don't know which program it is, then ask Microsoft (or whoever it is that you get these "chm" files from).
Bookmark Post in Technorati
Reply With Quote
  #39 (permalink)  
Old 07-12-2008, 09:05 AM
Senior Member
 
Join Date: Jun 2008
Posts: 121
Sarinam is on a distinguished road
Quote:
Originally Posted by masijade View Post
Oh come on. Do you know what program you have to use to view a "chm" file (whatever the heck that is)?

If so, use that programs executable as the command with the file returned from JFileChooser as an argument, instead of "start \\" in that exec statement.

And use the form of the exec method that takes an array rather than a string (and those links I posted earlier have more than enough info for you to figure out how to use that).

If you don't know which program it is, then ask Microsoft (or whoever it is that you get these "chm" files from).

Thxs it's solve after you vital help..
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +3. The time now is 01:33 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org