Ok, I'm a high school junior and I have a java programming class in which
the WHOLE class is stuck and cant figure the assignment out. our assignment
is to make a read from file, and present it in a window. I have completed
that part but what I need to do is find a way, code, or some help to make
each line of the text file I had my original applet create, read into a dialogue
box with an 'ok' button, I know JOptionPane and all that good stuff but I
dont know how to get this deal to work and its really frustrating, today
is the eigth day we've been working on this and I'm ready to give up. ANY
help would be much appreciated.

03-01-2001, 09:58 PM

Rajkamal Gopinath

Re: problemo

Hi,

This code reads from an application so you should not have any problem

but if you wish to read from the applet the same code will work but you need
to change the policy file to give the permission for the applet to have local
access to file

"Java Newbie" <onw_co@hotmail.com> wrote:
>
>Ok, I'm a high school junior and I have a java programming class in which
>the WHOLE class is stuck and cant figure the assignment out. our assignment
>is to make a read from file, and present it in a window. I have completed
>that part but what I need to do is find a way, code, or some help to make
>each line of the text file I had my original applet create, read into a
dialogue
>box with an 'ok' button, I know JOptionPane and all that good stuff but
I
>dont know how to get this deal to work and its really frustrating, today
>is the eigth day we've been working on this and I'm ready to give up. ANY
>help would be much appreciated.

03-14-2001, 10:20 AM

Roberta Carr

Re: problemo

"Rajkamal Gopinath" <funkamal@yahoo.com> wrote:
>
>Hi,
>
>This code reads from an application so you should not have any problem
>
>but if you wish to read from the applet the same code will work but you
need
>to change the policy file to give the permission for the applet to have
local
>access to file
>
>
>import java.io.*;
>import javax.swing.*;
>
>public class ShowLines extends JDialog
>{
>String fileName;
> public ShowLines(String fileName)
> {
> this.fileName=fileName;
> }
>
> public static void main(String args[]) throws Exception
> {
> ShowLines win=new ShowLines(args[0]);
> win.setSize(300,300);
> win.setVisible(true);
> win.showLines();
> }
>
> public void showLines() throws Exception
> {
> BufferedReader cin=new BufferedReader(new FileReader(fileName));
> String tmp;
> tmp=cin.readLine();
> while(tmp!=null)
> {
> JOptionPane.showMessageDialog(this,tmp,"Showline Dialog",0);
> tmp=cin.readLine();
> }
> }
>
>}
>
>
>
>
>
>"Java Newbie" <onw_co@hotmail.com> wrote:
>>
>>Ok, I'm a high school junior and I have a java programming class in which
>>the WHOLE class is stuck and cant figure the assignment out. our assignment
>>is to make a read from file, and present it in a window. I have completed
>>that part but what I need to do is find a way, code, or some help to make
>>each line of the text file I had my original applet create, read into a
>dialogue
>>box with an 'ok' button, I know JOptionPane and all that good stuff but
>I
>>dont know how to get this deal to work and its really frustrating, today
>>is the eigth day we've been working on this and I'm ready to give up. ANY
>>help would be much appreciated.
>
try adding actionPreformed to you code.