This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting text to appear in the JOptionPane function

 
jake bellhorn
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
import java.io.*;
class ReadTextFile
{
public static void main ( String[] args )
{
String fileName = "hockey pool.txt" ;
String line;
try
{
BufferedReader in = new BufferedReader(
new FileReader( fileName ) );
line = in.readLine();
while ( line != null ) // continue until end of file
{
System.out.println( line );
line = in.readLine();
}
in.close();
}
catch ( IOException iox )
{
System.out.println("Problem reading " + fileName );
}
}
}
---------------------------------------------------------------------------

this program opens a text file and i was wondering what do i have to add to this code so that it shows up in the JOptionPane function
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the Swing forum.

In the meantime, try this tutorial on How to Make Dialogs (JOptionPanes).
 
Michael Dunn
Ranch Hand
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here's a simple way
(if there's a lot of text, put the textarea into a JScrollPane
and give the scrollPans a preferredSize)
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic