Page 2 of 2 FirstFirst 12
Results 21 to 39 of 39

Thread: [SOLVED] Chm

  1. #21
    Sarinam is offline Senior Member
    Join Date
    Jun 2008
    Posts
    121
    Rep Power
    0

    Default

    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.

  2. #22
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

  3. #23
    Sarinam is offline Senior Member
    Join Date
    Jun 2008
    Posts
    121
    Rep Power
    0

    Default

    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

  4. #24
    Sarinam is offline Senior Member
    Join Date
    Jun 2008
    Posts
    121
    Rep Power
    0

    Default

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

  5. #25
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    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.

  6. #26
    Sarinam is offline Senior Member
    Join Date
    Jun 2008
    Posts
    121
    Rep Power
    0

    Default

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

    Java 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();
    		    	}
    		    	
    		  } 
    	 
    }

  7. #27
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    8

    Default

    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?

  8. #28
    Sarinam is offline Senior Member
    Join Date
    Jun 2008
    Posts
    121
    Rep Power
    0

    Default

    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

  9. #29
    Sarinam is offline Senior Member
    Join Date
    Jun 2008
    Posts
    121
    Rep Power
    0

    Default

    SIr plz tell me how can i do ..

  10. #30
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    8

    Default

    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.

  11. #31
    Sarinam is offline Senior Member
    Join Date
    Jun 2008
    Posts
    121
    Rep Power
    0

    Default

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

  12. #32
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    8

    Default

    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.

  13. #33
    Sarinam is offline Senior Member
    Join Date
    Jun 2008
    Posts
    121
    Rep Power
    0

    Default

    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

    Java 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

  14. #34
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    8

    Default

    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

  15. #35
    Sarinam is offline Senior Member
    Join Date
    Jun 2008
    Posts
    121
    Rep Power
    0

    Default

    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

  16. #36
    Sarinam is offline Senior Member
    Join Date
    Jun 2008
    Posts
    121
    Rep Power
    0

    Default

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

  17. #37
    Sarinam is offline Senior Member
    Join Date
    Jun 2008
    Posts
    121
    Rep Power
    0

    Default

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

    Java 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

  18. #38
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    8

    Default

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

  19. #39
    Sarinam is offline Senior Member
    Join Date
    Jun 2008
    Posts
    121
    Rep Power
    0

    Default

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

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •