Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I have no idea what I'm doing wrong, I'm trying to get a file i choose to read a textArea but every time i run
I have no idea what I'm doing wrong, I'm trying to get a file i choose to read a textArea but every time i run the program nothing comes up in the textArea. this is the part of the code i need help with. i only can use scanner object not buffered or filereader.
else if (e.getActionCommand ().equals ("open")) //textArea. 3etText ( "") ; exampleChooser-new JFileChooser); int result = exampleChooser.showOpenDialog (null); File selectedFile-null; try ( if (resultJFileChooser. APPROVE OPTION selectedFile exampleChooser.getSelectedFile );) Scanner fileReader new Scanner (selectedFile): while (fileReader.hasNextLine ()--true) ( 3 //String newerFile-f1leReader.nexcline // String tempLine="w. ) ) ) ) cextArea. setText (fileReader.nextLine ) 56 57 158 159 160 catch (FileNotFoundException ex) ( null, Logger.getLogger (TextEditorFrame . class.getName()).log (Level.SEVERE, 161 162Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started