Please make the java file compile sucessfully. (Multithreaded Finding the Largest File in a Directory)"LargestfileA8" (continued)  LargestFileA7.java:8: error: class LargestFileA8 is public, should be declared in a file named LargestFileA8.javapublic class LargestFileA8 {DirectoryController.java:17: error: cannot find symbol        view.addActionListener(new DirectoryListener());  symbol:   method addActionListener(DirectoryController.DirectoryListener)  location: variable view of type DirectoryView DirectoryController.java:40: error: DirectoryController.LargestFileFinder is not abstract and does not override abstract method doInBackground() in SwingWorker    class LargestFileFinder extends SwingWorker<Void, Void> { DirectoryController.java:48 (error)DirectoryController.java:47 (error)DirectoryController.java:50 (error) "Largestfilea8.java" public class LargestFileA8 {    public static void main(String[] args) {        // Create instances of the model, view, and controller        DirectoryModel model = new DirectoryModel();        DirectoryView view = new DirectoryView();        DirectoryController controller = new DirectoryController(model, view);    } "DirectoryModel.Java" import java.nio.file.*;import java.nio.file.attribute.BasicFileAttributes;import java.io.IOException; public class DirectoryModel {    private Path largestFilePath;    private long largestFileSize;     public DirectoryModel() {        largestFilePath = null;        largestFileSize = 0;    }     // Method to find the largest file in the directory    public void findLargestFile(Path directoryPath) {        try {            Files.walkFileTree(directoryPath, new SimpleFileVisitor<Path>() {                @Override                public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {                    if (attrs.size() > largestFileSize) {                        largestFileSize = attrs.size();                        largestFilePath = file;                    }                    return FileVisitResult.CONTINUE;                }                 @Override                public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException {                    return FileVisitResult.CONTINUE;                }            });        } catch (IOException e) {            e.printStackTrace();        }    }     // Getter method for the largest file path    public Path getLargestFilePath() {        return largestFilePath;    }     // Getter method for the size of the largest file    public long getLargestFileSize() {        return largestFileSize;    }}   "DirectoryController.java" needs to be completedimport java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.nio.file.Files;import java.nio.file.Path;import java.nio.file.Paths;import javax.swing.SwingWorker; public class DirectoryController {    private DirectoryModel model;    private DirectoryView view;     public DirectoryController(DirectoryModel model, DirectoryView view) {        this.model = model;        this.view = view;         // Add ActionListener to the view's Browse button        view.addActionListener(new DirectoryListener());    }... "DirectoryView.java" Needs to be completedimport javax.swing.*;import javax.swing.border.EmptyBorder;import java.awt.*;import java.awt.event.*;import java.io.IOException;import java.nio.file.*;import java.text.SimpleDateFormat;import java.util.Date; public class DirectoryView extends JFrame {    private JTextField directoryField;    private JTextArea resultArea;    private JButton browseButton; ...

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Question
100%

Please make the java file compile sucessfully. (Multithreaded Finding the Largest File in a Directory)

"LargestfileA8" (continued) 

LargestFileA7.java:8: error: class LargestFileA8 is public, should be declared in a file named LargestFileA8.java
public class LargestFileA8 {
DirectoryController.java:17: error: cannot find symbol
        view.addActionListener(new DirectoryListener());
  symbol:   method addActionListener(DirectoryController.DirectoryListener)
  location: variable view of type DirectoryView

DirectoryController.java:40: error: DirectoryController.LargestFileFinder is not abstract and does not override abstract method doInBackground() in SwingWorker
    class LargestFileFinder extends SwingWorker<Void, Void> {


DirectoryController.java:48 (error)
DirectoryController.java:47 (error)
DirectoryController.java:50 (error)

"Largestfilea8.java"


public class LargestFileA8 {
    public static void main(String[] args) {
        // Create instances of the model, view, and controller
        DirectoryModel model = new DirectoryModel();
        DirectoryView view = new DirectoryView();
        DirectoryController controller = new DirectoryController(model, view);
    }

"DirectoryModel.Java"

import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.io.IOException;

public class DirectoryModel {
    private Path largestFilePath;
    private long largestFileSize;

    public DirectoryModel() {
        largestFilePath = null;
        largestFileSize = 0;
    }

    // Method to find the largest file in the directory
    public void findLargestFile(Path directoryPath) {
        try {
            Files.walkFileTree(directoryPath, new SimpleFileVisitor<Path>() {
                @Override
                public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
                    if (attrs.size() > largestFileSize) {
                        largestFileSize = attrs.size();
                        largestFilePath = file;
                    }
                    return FileVisitResult.CONTINUE;
                }

                @Override
                public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException {
                    return FileVisitResult.CONTINUE;
                }
            });
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    // Getter method for the largest file path
    public Path getLargestFilePath() {
        return largestFilePath;
    }

    // Getter method for the size of the largest file
    public long getLargestFileSize() {
        return largestFileSize;
    }
}

 

"DirectoryController.java" needs to be completed

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import javax.swing.SwingWorker;

public class DirectoryController {
    private DirectoryModel model;
    private DirectoryView view;

    public DirectoryController(DirectoryModel model, DirectoryView view) {
        this.model = model;
        this.view = view;

        // Add ActionListener to the view's Browse button
        view.addActionListener(new DirectoryListener());
    }
...

"DirectoryView.java" Needs to be completed

import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.*;
import java.io.IOException;
import java.nio.file.*;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DirectoryView extends JFrame {
    private JTextField directoryField;
    private JTextArea resultArea;
    private JButton browseButton;

...

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Stack operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education