Hirdetés
- D1Rect: Nagy "hülyétkapokazapróktól" topik
- joghurt: Megtarthatod a jogsid?
- sziku69: Fűzzük össze a szavakat :)
- Magga: PLEX: multimédia az egész lakásban
- laskr99: Processzor és videokártya szilícium mag fotók újratöltve!
- Brogyi: CTEK akkumulátor töltő és másolatai
- Sub-ZeRo: Euro Truck Simulator 2 & American Truck Simulator 1 (esetleg 2 majd, ha lesz) :)
- Luck Dragon: Asszociációs játék. :)
- Syl: UPS - te áldott!
- gban: Ingyen kellene, de tegnapra
Ú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
Hirdetés
A topicot kiemeltem. Valaki nem akar egy nyitó hsz-t írni?:))
- WYBOT C2 Vision AI vezérelt medenceporszívó
- Új könyv: Grandpierre Attila: Az élő világegyetem könyve
- Apple iPhone 13 128GB,Átlagos,Adatkabel,12 hónap garanciával
- ÁRGARANCIA!Épített KomPhone i5 14400F 32/64GB DDR5 RTX 5060 Ti 8GB GAMER PC termékbeszámítással
- ÁRGARANCIA!Épített KomPhone i5 14400F 32/64GB RAM RX 9060 XT 8GB GAMER PC termékbeszámítással
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest

