|
|
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.
|
|

07-10-2008, 11:04 AM
|
|
Senior Member
|
|
Join Date: Jun 2008
Posts: 121
|
|
Originally Posted by Eranga
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.
|
|

07-10-2008, 11:06 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 4,609
|
|
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.
|
|

07-10-2008, 11:08 AM
|
|
Senior Member
|
|
Join Date: Jun 2008
Posts: 121
|
|
Originally Posted by Eranga
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
|
|

07-10-2008, 11:09 AM
|
|
Senior Member
|
|
Join Date: Jun 2008
Posts: 121
|
|
Originally Posted by Eranga
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..
|
|

07-10-2008, 11:11 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 4,609
|
|
|
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.
|
|

07-10-2008, 11:27 AM
|
|
Senior Member
|
|
Join Date: Jun 2008
Posts: 121
|
|
Originally Posted by 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.
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..
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();
}
}
}
|
|

07-10-2008, 11:50 AM
|
|
Senior Member
|
|
Join Date: Jun 2008
Posts: 484
|
|
|
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?
|
|

07-10-2008, 12:25 PM
|
|
Senior Member
|
|
Join Date: Jun 2008
Posts: 121
|
|
Originally Posted by masijade
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
|
|

07-10-2008, 02:15 PM
|
|
Senior Member
|
|
Join Date: Jun 2008
Posts: 121
|
|
|
SIr plz tell me how can i do ..
|
|

07-10-2008, 02:24 PM
|
|
Senior Member
|
|
Join Date: Jun 2008
Posts: 484
|
|
|
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.
|
|

07-10-2008, 02:39 PM
|
|
Senior Member
|
|
Join Date: Jun 2008
Posts: 121
|
|
Originally Posted by masijade
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..
|
|

07-10-2008, 03:06 PM
|
|
Senior Member
|
|
Join Date: Jun 2008
Posts: 484
|
|
Originally Posted by Sarinam
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.
|
|

07-10-2008, 03:22 PM
|
|
Senior Member
|
|
Join Date: Jun 2008
Posts: 121
|
|
Originally Posted by masijade
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
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
|
|

07-10-2008, 04:01 PM
|
|
Senior Member
|
|
Join Date: Jun 2008
Posts: 121
|
|
Originally Posted by masijade
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
|
|

07-11-2008, 08:06 AM
|
|
Senior Member
|
|
Join Date: Jun 2008
Posts: 121
|
|
Originally Posted by Sarinam
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..
|
|

07-11-2008, 04:06 PM
|
|
Senior Member
|
|
Join Date: Jun 2008
Posts: 121
|
|
Originally Posted by masijade
Sir now i am open file directly from directory..
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
|
|

07-11-2008, 04:44 PM
|
|
Senior Member
|
|
Join Date: Jun 2008
Posts: 484
|
|
|
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).
|
|

07-12-2008, 09:05 AM
|
|
Senior Member
|
|
Join Date: Jun 2008
Posts: 121
|
|
Originally Posted by masijade
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..
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|