Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.awt.datatransfer.*;

import java.io.File;
import java.util.List;

public class Main {
    /**
     * Returns a list of files from a given transferable.
     */
    public static List<File> getFiles(Transferable aTrans) {
        // Handle JavaFileListFlavor
        if (aTrans.isDataFlavorSupported(DataFlavor.javaFileListFlavor))
            try {
                return (List) aTrans.getTransferData(DataFlavor.javaFileListFlavor);
            } catch (Exception e) {
                System.err.println(e);
                return null;
            }

        // Otherwise return null
        return null;
    }
}