System.out.print("1");
System.out.println(ts.getComponent());
System.out.println(ts.getTransferable().getTransferData(DataFlavor.javaFileListFlavor));
String dir = ts.getTransferable().getTransferData(DataFlavor.javaFileListFlavor).toString();
File file = new File(dir);
System.out.println(file.getName());
System.out.println(file.getPath());
System.out.println(file.getTotalSpace());
long num = file.length();
System.out.println(num);
Вывод
1javax.swing.JTable[,0,0,556x64,alignmentX=0.0,alignmentY=0.0,border=javax.swing.plaf.synth.SynthBorder@1baabbd6,flags=251658568,maximumSize=,minimumSize=,preferredSize=,autoCreateColumnsFromModel=true,autoResizeMode=AUTO_RESIZE_SUBSEQUENT_COLUMNS,cellSelectionEnabled=false,editingColumn=-1,editingRow=-1,gridColor=javax.swing.plaf.ColorUIResource[r=35,g=35,b=36],preferredViewportSize=java.awt.Dimension[width=450,height=400],rowHeight=16,rowMargin=0,rowSelectionAllowed=true,selectionBackground=DerivedColor(color=57,105,138 parent=nimbusSelectionBackground offsets=0.0,0.0,0.0,0 pColor=57,105,138,selectionForeground=DerivedColor(color=255,255,255 parent=nimbusLightBackground offsets=0.0,0.0,0.0,0 pColor=255,255,255,showHorizontalLines=false,showVerticalLines=false]
[C:\Users\Ye\Desktop\Spotify.lnk]
Spotify.lnk]
[C:\Users\Ye\Desktop\Spotify.lnk]
0
Я не понимаю, как размер файла равен 0, несмотря на тестирование с несколькими файлами