How to use hadoop for text file?

JAVA GUI : How to use button listener to read and display text file?

  • What i want to happen in my program is when the button is clicked, it will initiate a button listener to read a text file and display the text in a dialog box. Can anyone give examples on how to do this?

  • Answer:

    Are you planning some thing like editor? May be in your actionPerformed method you can write the following assuming A is an TextArea type of global object public void actionPerformed(ActionEvent E) { Scanner S= new Scanner(new File("filename")); while(S.next()) { String L=S.nextLine(); A.append(L); or A.add(L); } }

Ame at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

You can find several examples on the internet, when utilizing Google's search. However, it can be hard to find when you don't know the right phrases to search for. Following are some links that might help (since I don't know if you are utilizing swing or awt): http://docs.oracle.com/javase/tutorial/ui/index.html http://docs.oracle.com/javase/tutorial/uiswing/index.html As mentioned on the last URL, there's a IDE (Integrated Development Environment) called NetBeans. The IDE is free for download. In addition, the download page (wwww.netbeans.org) also has several tutorials that might help you.

Neunerball

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.