Hide the path of the selected directory in JFileChooser

I’m using a JFileChooser to select only directories, so I set the selection mode to DIRECTORIES_ONLY, but the problem is when I select a directory, the absolute path is displayed in the text field as in the below picture:

Is there a way to display only the name of the directory, as in file selection mode?

This is my code:

import javax.swing.JFileChooser;

public class MyForm {


    public static void main(String[] args) {

        JFileChooser chooser = new JFileChooser();
        chooser.setCurrentDirectory(new java.io.File("./"));
        chooser.setDialogTitle("Select directory");
        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        chooser.setAcceptAllFileFilterUsed(false);

        if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
            System.out.println(chooser.getSelectedFile().getAbsolutePath());            
        }       
    }
}