0

I'm working on a school project and I need some help. The below works, but when I click on the "Report" button I want my data to print to a new frame. I'm not sure how to do this. Do I use a JFrame?

if(arg=="Report")
                {
                    try
                    {
                        DataInputStream readinput = new DataInputStream(new FileInputStream("poolvolumedata.txt"));
                        double inputlength;
                        double inputwidth;
                        double inputdepth;
                        double inputvolume;
                        //char tab;

                        try
                        {
                            while(true)
                            {
                                inputlength = readinput.readDouble();
                                readinput.readChar();
                                inputwidth = readinput.readDouble();
                                readinput.readChar();
                                inputdepth = readinput.readDouble();
                                readinput.readChar();
                                inputvolume = readinput.readDouble();

                                System.out.println(inputlength +  "\t" + inputwidth + "\t" +
                                                    inputdepth + "\t" + inputvolume);

Edited by Dani: Formatting fixed

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by stephen84s
0

Please use code tags and pay a little attention to the rules before posting.

Anyways if you just want to display the data in another window, the I would suggest you take a look at the JOptionPane

Also an alternative approach if you find the JOptionPane dialog boxes too restrictive would be, you extend from the JFrame class in your own custom class (ex. MyFrame), take the contents you want to be displayed as parameters to the constructor of this class(MyFrame), and display the contents using the appropriate controls(JLabel or JTextArea or JTextField ... whichever you wish).

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.