Title: Java-File and Directory
Information-Lesson 6-Writing the functionality that give us
information about the file-Part 2
Duration: 17 minutes
Summary: In this video we continue where we left off in part I. After we create the GUI, we concentrate on writing the functionality that give us the information about the file. We need to support files and directories. So, we first get the user’s selection from the JFileChooser. We pass that selection into a method (getFileInfo()). In this method, we make sure first that the file exists. Then, we retrieve all the information we need (is it a file? Is it a directory? How big is it? What is the path? …). If it is a directory, we display its content.
Methodology of the development of example: Good coding standard and simplified design to illustrate the key points.
Technology Used: Java – File and Swing component.
Keywords: JTextArea, JScrollPane, JFrame, BorderLayout, setSize(), setVisible(), File, JOptionPane, showMessageDialog, ERROR_MESSAGE, format, isDirectory, lastModified, getAbsolutePath, append, JFileChooser, isFile.