Új hozzászólás Aktív témák
-
n00n
őstag
A legegyszerűbb, ha ideírom a forráskódot:
class Copy extends SwingWorker<Void, Void> {
private File selectedfile = new File("D:/Adatok/proba.file");
private File chosenDestination = new File("D:/Adatok/ide/proba.file");
@Override
protected Void doInBackground() throws Exception {
try {
FileInputStream fileInputStream = new FileInputStream(
selectedfile);
BufferedInputStream bufferedInputStream = new BufferedInputStream(
fileInputStream);
ProgressMonitorInputStream progressMonitorInputStream;
UIManager.put("ProgressMonitor.progressText", "Mentés másolása");
UIManager.put("OptionPane.cancelButtonText", "Mégse");
progressMonitorInputStream = new ProgressMonitorInputStream(MentesPanel.this, "Fájl másolása folyamatban", bufferedInputStream);
File outputFile = new File("" + chosenDestination);
FileOutputStream fileOutputStream = new FileOutputStream(
outputFile);
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(
fileOutputStream);
int data;
byte[] buffer = new byte[1024];
while ((data = progressMonitorInputStream.read(buffer)) > 0) {
bufferedOutputStream.write(buffer);
}
bufferedOutputStream.close();
progressMonitorInputStream.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
public void done() {
JOptionPane.showMessageDialog(MentesPanel.this, "A mentés másolása befejeződött!", "Kész", 1);
}
}
}
Új hozzászólás Aktív témák
A topicot kiemeltem. Valaki nem akar egy nyitó hsz-t írni?:))
- Yoga Pro 9 14IRP8 14.5" 3K IPS i9-13905H RTX 4060 32GB 1TB NVMe IR kam gar
- ThinkPad X1 Yoga Gen 5
- Latitude 7650 16" FHD+ IPS Ultra 7 165U 16GB 512GB NVMe magyar vbill ujjlolv IR kam gar
- Sapphire ATI Radeon HD 3850 AGP
- iPhone 17 Pro max 512GB gyári független Silver hibátlan 2028.09.19 gyártói jótállás
- Dell Precision 3571 4G LTE i7-12700H 32GB 1000GB FHD RTX A1000 4GB 1 év teljeskörű garancia
- Vásárlunk iPhone 12/12 Mini/12 Pro/12 Pro Max
- GYÖNYÖRŰ iPhone 12 mini 128GB Blue -1 ÉV GARANCIA - Kártyafüggetlen, MS3853
- Realme 9 Pro 128GB, Kártyafüggetlen, 1 Év Garanciával
- Katonai Rugged laptopok Panasonic Toughbook és Getac S410 6-11.gen gar.
Állásajánlatok
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest
Cég: Laptopműhely Bt.
Város: Budapest

