It's not a secret anymore!*
The moose likes Swing / AWT / SWT and the fly likes getting text to appear in the JOptionPane function Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "getting text to appear in the JOptionPane function" Watch "getting text to appear in the JOptionPane function" New topic
Author

getting text to appear in the JOptionPane function

jake bellhorn
Greenhorn

Joined: May 03, 2006
Posts: 24
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

Joined: Aug 31, 2004
Posts: 11343

Moving to the Swing forum.

In the meantime, try this tutorial on How to Make Dialogs (JOptionPanes).


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
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
 
subject: getting text to appear in the JOptionPane function
 
Similar Threads
println Vs newLine method
Need to read and write data from file.
skip blank lines in reading from text file
How to append text to the end of a text file?
Read text file through oracle procedure