Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-09-2008, 01:55 PM
Member
 
Join Date: Jul 2008
Posts: 18
Rep Power: 0
JavaLerner is on a distinguished road
Default Open File
Hi all

How can i open a .txt file through menu item.Plz help me
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 07-09-2008, 04:49 PM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: SouthWest Missouri, USA
Posts: 2,229
Rep Power: 4
Norm is on a distinguished road
Default
Add a listener to the menu item and when the item is selected, the listener will be called and there you can open the file.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-10-2008, 07:19 AM
Member
 
Join Date: Jul 2008
Posts: 18
Rep Power: 0
JavaLerner is on a distinguished road
Default
Originally Posted by Norm View Post
Add a listener to the menu item and when the item is selected, the listener will be called and there you can open the file.
Sir can you give me some code of this..
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 07-10-2008, 06:14 PM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: SouthWest Missouri, USA
Posts: 2,229
Rep Power: 4
Norm is on a distinguished road
Default
You can probably find all you want by using a search.
Look that the API doc for the type of menu item you are using, find the addListener methods that are defined for that class and do a search for those methods. That could find you examples of how to use them.
Same for the other parts of the problem.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 07-12-2008, 07:21 PM
Member
 
Join Date: Jul 2008
Posts: 33
Rep Power: 0
Engineeringserver.com is on a distinguished road
Default
You can use the File class to open a file and the scanner class to read it. It isn't that difficult to write a simple text reader.
__________________
My community with sourcode and examples
Java remote image server/client working proof of concept: uitstekendeaccu.nl/tmp/
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 07-12-2008, 07:41 PM
Nicholas Jordan's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Southwest
Posts: 1,018
Rep Power: 3
Nicholas Jordan is on a distinguished road
Default oversimplified place to start
Originally Posted by Engineeringserver.com View Post
You can use the File class to open a file and the scanner class to read it. It isn't that difficult to write a simple text reader.
Java Learner,

These other two posters are heavily experienced, I did not try to get this to compile: They can help you with this:

Code:
import java.io.File;// 
import java.io.PrintWriter://
public class FileDemo
{
    public static void main(String[] args)
    {
        // Simple
        for(int i= 0;i < args.length;i++)
        {
            File nextFile = new File(args[i]);
            if(nextFile.exists())
            {
                ;// That file already exists.
            }
            else
            {
                PrintWriter printWrite
                =
                new PrintWriter(nextFile);
        }
    }
}
__________________
Introduction to Programming Using Java.
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
open a pdf file in linux aparna Advanced Java 4 09-28-2008 06:37 AM
how to open a file through URL katie New To Java 3 07-13-2008 03:53 AM
To open an image file such as Jpeg file using JAva Program itmani2020 Advanced Java 10 07-11-2008 10:57 AM
Is it possible to open a txt file? jason27131 New To Java 20 08-07-2007 02:24 AM
open lazlo Peter Advanced Java 2 07-04-2007 07:22 AM


All times are GMT +2. The time now is 03:00 PM.



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