1 26 27 package org.objectweb.ccm.filetransfer.cif; 28 29 32 33 import java.io.*; 34 import java.awt.*; 35 import javax.swing.*; 36 import java.lang.*; 37 38 public class FileTransfert_impl { 39 40 41 42 private JButton label_ = null; 43 private Image img = null; 44 private JButton screen_ = null; 45 private javax.swing.ImageIcon imgicon = null; 46 47 48 52 FileTransfert_impl(JButton screen, JButton label) { 53 54 55 screen_ = screen; 56 label_ = label; 57 screen_.setBackground(Color.white); 58 59 } 60 61 65 public void storeLastSend(byte[] last_send, String filename) { 66 67 FileOutputStream file = null; 68 java.io.File currentdir = new java.io.File (System.getProperty("user.dir")); 69 currentdir = new java.io.File (currentdir.getParent()); 70 71 System.out.println("=== " + currentdir.getParent() + "/IMAGE/Receive/" + filename); 72 73 try { 74 file = 75 new FileOutputStream(currentdir.getParent() + "/IMAGE/Receive/" + filename); 76 file.write(last_send); 77 file.close(); 78 79 } catch (java.io.IOException ex) { 80 System.err.println("Can't write to " + ": " + ex.getMessage()); 81 System.exit(1); 82 } 83 } 84 85 public synchronized void display_image(byte[] last_send, String filename) { 86 87 label_.setLabel("<<" + filename + ">>"); 89 imgicon = new javax.swing.ImageIcon (last_send); 90 screen_.setIcon(imgicon); 91 } 92 93 } 94 | Popular Tags |