0

Okay, well, my brain has imploded and now I'm about to die.
Still stuck >.< Arrggghh.
Looked stuff up and im still confused with apples. :S

0

You cannot understand how to use that method to append text to your JTextArea?? Are you kidding? What part of that is confusing? Perhaps we aren't understanding just what you're wanting to do.

0

Well I need it to add the line from FInputStream to add to area(JTextArea) instead of replacing it.

0

Uh, no one?
Well I've concluded on using a JFileChooser but it still doesn't save. It runs the catch exception:

class newfile implements ActionListener{

			@Override
			public void actionPerformed(ActionEvent arg0) {
				Newf.showDialog(null, "Create New File");
				
					try{
						Formatter x = new Formatter(Newf.getName(null));
					}catch(Exception e){
						JOptionPane.showMessageDialog(null, "Error, file not created.\nPlease try again");
						
					}
				
			}
}

Edited by TheSecOrg: Forgot the extra } ☺

0

Sorry theSecOrg. I kinda wandered off at the point where you posted

Well I need it to add the line from FInputStream to add to area(JTextArea) instead of replacing it.

because if you still didn't get what Azzaral and I had been saying then there seemed little point continuing.
I had even less idea what the latest post had to do with that anyway.

Maybe its time for you to post all your (relevant) latest code and a full description of exactly what problems you still have - and I mean a proper description - complete exception stack trace and or exact expected vs actual results.

0

Okay, I have a JFileChooser called Newf and it shows a dialog (Newf.showDialog) and it should be that when you click 'Create New File' (OK button thing) it creates a file using a formatter which is called 'x' and gives the name of the thing you typed in the JFileChooser except it doesn't it gives the catch error.
My Code:

final JFileChooser savef = new JFileChooser();
final JFileChooser loadf = new JFileChooser();
final JFileChooser Newf = new JFileChooser();
...
...
class newfile implements ActionListener{

			@Override
			public void actionPerformed(ActionEvent arg0) {
				Newf.showDialog(null, "Create New File");
				
					try{
						Formatter x = new Formatter(Newf.getName(null));
					}catch(Exception e){
						JOptionPane.showMessageDialog(null, "Error, file not created.\nPlease try again");
						
					}
				
			}
			
		}

The ... means that there's code but it's irrelevant.
Is there any other information you need?

0

Let's get some more data to help pin down the problem.
After line 12 try printing the value of Newf.getName(null) so we can see what you are passing to the new Formatter
After line 14 try an e.printStackTrace() so we can see exactly what the exception was.

0

I used JOptionPane.showMessageDialog(null, Newf.getName(null)); and it said nothing, so it's passed nothing on to the formatter but why?
Maybe it's not getName.
In the console, I think this is what e.printStackTrace() does, it says in the console:

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.