Applet that saves images in server

Hi. I want to know if is possible that an simple drawing applet saves the image as png, gif or any that was draw in the applet.
If so what clases i have to look.

Appears it wont work. Since the last project didnt require
any installs from the end user, I wont be able to get away with it
for this one.
(user would need to have AIR installed on their machine)
http://labs.adobe.com/wiki/index.php/AIR:Developer_FAQ#Can_I_create_CD-ROM_or_kiosk_applic ations_that_leverage_Adobe_AIR.3F

Similar Messages

  • Save image to Server in folder from iframe tag

    I am using iframe tag to display image. Also there is a Save Image Button on page. I want that when user rotate the image inside iframe, then this rotated image should save into server in folder by click of a button.
    How to do this...plz help

    Hi Rajnegi,
    In my opinion, this thread is related to ASP.NET forum. So please post thread on that forum for more effective response. Thank you for understanding. Please refer to the following link.
    http://forums.asp.net/.
    To save your time, the following way is a popular way to upload images to server. You can put the code in your iframe. Please see the page below:
    http://www.aspsnippets.com/Articles/Multiple-File-Uploads-Gmail-Style-using-JQuery-and-ASP.Net.aspx.
    Hope useful.
    Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Java applet - save image to server...

    My applet generates Image object which I then want to save it to that same server that the applet is running from.
    I'm planning to send the image to a .php file through $_POST parameter and then let the PHP deal with the filename, location...etc
    How would I do that? I tried every keyword combination with google and I haven't found any good examples on this. Either it's too simple or too hard?

    yeah I thought about that.
    I'm trying to post the entire image to my servlet.
    Here is what I got so far:
                    URL url = new URL("http://www.example.com/test/something.php");
                    URLConnection urlConn = url.openConnection();
                    DataOutputStream printout;
                    DataInputStream input;
                    urlConn.setDoInput(true);
                    urlConn.setDoOutput(true);
                    urlConn.setUseCaches(false);
                    printout = new DataOutputStream(urlConn.getOutputStream());
                    printout.writeBytes("imagedata=");
                    printout.write(bytesOut); // bytesOut is my BufferedImage converted into bytes array
                    printout.flush();
                    printout.close();my servlet code:
    <?php
    $img_data = $_POST['imagedata'];
    $fp = fopen('test.jpeg', 'w');
    fwrite($fp, $img_data);
    fclose($fp);
    ?>
    the servlet DOES receive the image but the image is corrupted.

  • Problems embedding in HTML an Applet that uses jdbc connection

    Dear Everyone,
    I'm having some problems deploying an applet that loads image paths from a mysql database. I manage to run the applet in appletviewer through netbeans but can't get to run it embedded in HTML code. The error I get from the java console is:
    load: class imagedisplay/MainApplet.class not found.
    java.lang.ClassNotFoundException: imagedisplay.MainApplet.class
         at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.FileNotFoundException: E:\My Documents\NetBeansProjects\imagedisplay\src\imagedisplay\MainApplet\class.class (The system cannot find the path specified)
         at java.io.FileInputStream.open(Native Method)
         at java.io.FileInputStream.<init>(Unknown Source)
         at java.io.FileInputStream.<init>(Unknown Source)
         at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
         at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
         at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
         at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
         at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         ... 7 more
    Exception: java.lang.ClassNotFoundException: imagedisplay.MainApplet.class...where MainApplet.class is the applet class file. I surely don't know what class.class is but I suspect that it might be related to the mysql jdbc driver as I'm totally clueless about where to put it.
    In all I have MainApplet.class (applet) and DoubleBufferApplet.class (applet related), Data.class and ImagePaths.class (to load data from the database) and the mysql jdbc driver jar file. DoubleBufferApplet, Data and ImagePaths are in a package called imagedisplay.
    The HTML is as follows
    <HTML>
    <HEAD>
       <TITLE>Applet HTML Page</TITLE>
    </HEAD>
    <BODY>
      <applet code="MainApplet.class" width="500" height="140">
      </applet>
    </BODY>
    </HTML>Help is much appreciated.
    Regards,
    William.

    Hello Everyone,
    I sorted it out by a series of changes to the file structure, packages and HTML code. I still can't get it to work, but I'll start another thread for that
    Regards,
    William.

  • How to save image files into SQL Server?

    Hello, All:
    Does anyone know how to save image files into SQL Server? Does the file type have to be changed first?? Please help me! Thank you!

    You need a BLOB field (usually)... Then you can check this tutorial out:
    http://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/exercises/BLOBPut/
    There are other exercises on that site, including one on reading the images back.

  • Lately while doing a 'save image as', it tries to 2nd guess me. I HATE that! Any way to turn this feature off?

    Doing the 'save image as' option, it will go back to the previous folder and keep going there for about 5 times before it save the image to the folder I want. Then when I change folders again, it will go back to the previous folder for about 5 more times. Is there any way to turn this feature off? I do not like it at all.

    Current Firefox versions remember the download directory based upon the URL, so if the URL changes then the default folder may be chosen if there hasn't been selected a download folder before for that server.
    *[[/questions/889958]]
    *[[/questions/882443]]
    Firefox 11 will have a workaround by providing a pref ( browser.download.lastDir.savePerSite) to disable this feature.

  • I need a script that can save images in whatever directory they reside in

    I am working on a project where I have over 1500 directories that have multiple .TIF images in each one. I am looking for a solution where I can run a script (which may or may not call on actions) that allows me to save each .TIF as a .PSD and again as a .PNG (with specific optimization settings) in the same directory as the original .TIF. The main idea here is I need to be able to run the script and walk away. So I'm looking for a one press option for each directory.
    I can create an action that saves the files in the proper format but when I record the action it saves the file in "folder 1". When I run this action again on "folder 2" it saves the images in "folder 1."  I could certainly make adjustments in the "Batch" dialog box by choosing the over ride "save as" function but the goal is to not have to do that 1500 times.
    So, my question is, is there a single script out there that can save images next to the original .TIFFS regardless of what directory the reside in? I'm no scripting guru, but perhaps the code uses something with a "this" command to specify the folder to save images to? Is this even possible? If so, are there web sites I can buy this from? Is there a scripting community that can provide these services?
    Any help to point me in the right direction is much appreciated.
    Mike

    You could try my Picture Processor ...
    http://www.ps-scripts.com/bb/viewtopic.php?f=10&t=3409&sid=3925f7039423a428ed082feba2c0aee 9
    Use the second download.

  • Help! Save to remote server has broken links to all images

    Okay, I (now) know this was a stupid thing to do - but surely there must be an easy way to rectify it...!?
    I usually 'PUT' the html files to the remote server, once they have been saved locally. But I keep getting frustrated with the uploading of all the dependency files, so... I 'discovered' the command 'SAVE TO REMOTE SERVER' and used this to save my html file directly to the server. I was asked if I wanted to update all the links - and I clicked YES (doh!)
    Now all my images and links are broken.
    I know it is just a single page - but it contains quite a number of links and images. Also, this page used a template and the image/links from the template within this one file are also broken. (The actual template file and all the other pages in the site are okay)
    'Undo' did not work
    Does anybody know a quick way to fix this?
    I am using Macromedia Dreamweaver MX 2004
    MANY thanks in advance,
    Rich

    I 'discovered' the command 'SAVE TO REMOTE SERVER' and used this to save my html file directly to the server. I was asked if I wanted to update all the links - and I clicked YES ...
    Sorry to say you've learn a valuable lesson the hard way.  Never, never save to remote server without first checking your work locally.
    You'll need to fix the links. Working locally and in code view, identify the path problem.  Do a Find & Replace (Ctrl+F) in the source code.  Test in browsers.  THEN when everything works properly upload to server.
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://alt-web.com/
    http://twitter.com/altweb
    http://alt-web.blogspot.com

  • Bug when save area flash to image on server

    hi all,
    I've a problem when save area flash to image on server (both Win or Linux), but on local (OS: Window) it allaway runs well. I try to find this bug, when user "loadMovie" function it's bug, but i don't use "loadMovie" function it runs well (on Sever)
    source below:
    * Print Button has been clicked
    function print_me(){
        trace("printing...");
        var _loc4 = new flash.display.BitmapData(300,300, false);
        _loc4.draw(this);
        my_mc = _root.snap_mc;
        my_mc.cont_mc.attachBitmap(_loc4, 5, "auto", true);
        my_mc.cont_mc._width = 200;
        my_mc.cont_mc._yscale = my_mc.cont_mc._xscale;
        var _loc2 = new flash.display.BitmapData(my_mc._width, my_mc._height, false);   
        _loc2.draw(my_mc);
        myclr = "";
        for (i = 0; i < _loc2.width; i++)
            for (j = 0; j < _loc2.height; j++)
                clr = _loc2.getPixel(i, j).toString(16); // cannot get color of this pixel when it runs on server(all away return FFFFFF - white) , but on local it runs well
                myclr = myclr + (clr + ",");
            } // end of for
        } // end of for
        var _loc3 = new LoadVars();
        _loc3.w = _loc2.width;
        _loc3.h = _loc2.height;
        _loc3.clr = myclr;
         _root.result_.text    = myclr;
         // send php save image
          _loc3.sendAndLoad("http://example.com/save_image.php", _loc3, "post");
    var mclListener:Object = new Object();
    mclListener.onLoadStart = function(target_mc1:MovieClip) {
       trace("start");
    mclListener.onLoadComplete = function(target_mc1:MovieClip) {
      trace("complete");
    //abc();
    mclListener.onLoadInit = function(target_mc1:MovieClip) {
       trace("onLoadInit");
        // Print when load image completed
        print_me();
    mclListener.onLoadError = function(target_mc1:MovieClip) {
       trace("error");
    var image_mcl:MovieClipLoader = new MovieClipLoader();
    image_mcl.addListener(mclListener);
    _root.mc.loadMovie('http://example.com/box_rose_frame.jpg');
    any body help?
    thanks

    thanks your help.
    I fixed it: if use "loadMovie(url)" function with
    - Url: remote, ex: http://example.com/abc.jpg => errror
    -Url: local, ex: ../../upload/abc.jpg => run well
    it's fixed
    Regard

  • Trying to write an applet that reads/displays a file from a remote server

    Hey all,
    I'm trying to make a little applet that launches from a browser that allows me to read a file from a server, reads it line by line and displays each line, and continues to read/monitor the file until I get a specific line of text.
    I've tried to do some code and although I can read the file (and display it), I can't seem to detect the end string (the if statement that tests if the line == "--END--" seems to have no effect, i.e. constant false).
    I have a feeling the approach I took is wrong since this seems insecure and just looks bad (I've seen stuff that seems to indicate I need to do something with implements Runnable or something.) Even if anyone doesn't have the time to actually do the framework of this, if they could perhaps outline an approach and any necessary topics I need to look at (such as
    1. Go and read the threads tutorial.
    2. Go and read the X section in the Y tutorial.
    3. Check out this <link>, as they seem to be doing something similar to what you're doing.
    Thanks in advance.
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    import java.awt.*;
    import java.net.*;
    public class FaxTest extends JApplet {
         JTextArea area;
         JScrollPane pane;
         String display;
         String old_display;
         String tmp;
         boolean end = false;
         java.util.Timer FileTimer = new java.util.Timer();
         TimerTask FileReadTask = new readFile();
         public void init() {
              area = new JTextArea();
              area.setWrapStyleWord(true);
              area.setLineWrap(true);
              area.setEditable(false);
              pane = new JScrollPane(area);
              Container c = getContentPane();
              c.add(pane);
              FileTimer.schedule(FileReadTask, 500,5000);
         public void stop()
              FileTimer.stop();
         class readFile extends TimerTask {
              public void run() {
              java.util.Timer timer = new java.util.Timer();
              TimerTask task = new FaxUpdate();
              timer.schedule(task, 1000,1000);
              try {
              display = "";
              String filename = getParameter("FILENAME");
              URL url = new URL(filename);
              InputStreamReader in = new InputStreamReader(url.openStream());
              BufferedReader br = new BufferedReader(in);
              while( (tmp = br.readLine()) != null) {
                   if (tmp == "--END--\n") end = true;
                   display += tmp;
              catch(IOException error) {
              display = "Error" + error;
         class FaxUpdate extends TimerTask {
              public void run() {
              if(end == true) {
                   area.setText("finito");
              else area.setText(display);
    }

    use tmp.equals("--END--\n") instead of tmp == "--END--\n"
    The == means does tmp reference the same object as "--END--\n" which will probably never be true. Using the equals method means does tmp contains the same characters as "--END--\n"

  • How to play/record at same time and save image from video

    i started working on a project and that made my life hell although it was so simple. reason was that i couldnt find small/simple code to understand problems and no proper documents. . finally i have done that. and here is the code (without much complex code of interface). it shows vidoe, records a small part of it at start and takes a snapshot (no buttons or events involved). hope it might help someone starting to learn JMF.
    import java.io.*;
    import java.awt.*;
    import java.net.*;
    import java.awt.event.*;
    import java.util.Vector;
    import javax.media.*;
    import javax.media.rtp.*;
    import javax.media.rtp.event.*;
    import javax.media.rtp.rtcp.*;
    import javax.media.protocol.*;
    import javax.media.protocol.DataSource;
    import javax.media.format.AudioFormat;
    import javax.media.format.VideoFormat;
    import javax.media.Format;
    import javax.media.format.FormatChangeEvent;
    import javax.media.control.BufferControl;
    import javax.media.control.FrameGrabbingControl;
    import javax.imageio.ImageIO;
    import java.util.Date;
    import javax.media.util.BufferToImage;
    import java.awt.image.BufferedImage;
    * AVReceive2 to receive RTP transmission using the new RTP API.
    public class AVReceive2 implements ReceiveStreamListener, SessionListener,
    ControllerListener
    public static DataSource ds2, ds, ds3;
    String sessions[] = null;
    RTPManager mgrs[] = null;
    Vector playerWindows = null;
    boolean dataReceived = false;
    Object dataSync = new Object();
    public AVReceive2(String sessions[]) {
    this.sessions = sessions;
    public static DataSource getData() {
    return ds;
    protected boolean initialize() {
    try {
    InetAddress ipAddr;
    SessionAddress localAddr = new SessionAddress();
    SessionAddress destAddr;
    mgrs = new RTPManager[sessions.length];
    playerWindows = new Vector();
    SessionLabel session;
    // Open the RTP sessions.
    for (int i = 0; i < sessions.length; i++) {
    // Parse the session addresses.
    try {
    session = new SessionLabel(sessions);
    } catch (IllegalArgumentException e) {
    System.err.println("Failed to parse the session address given: " + sessions[i]);
    return false;
    System.err.println(" - Open RTP session for: addr: " + session.addr + " port: " + session.port + " ttl: " + session.ttl);
    mgrs[i] = (RTPManager) RTPManager.newInstance();
    mgrs[i].addSessionListener(this);
    mgrs[i].addReceiveStreamListener(this);
    ipAddr = InetAddress.getByName(session.addr);
    if( ipAddr.isMulticastAddress()) {
    // local and remote address pairs are identical:
    localAddr= new SessionAddress( ipAddr,
    session.port,
    session.ttl);
    destAddr = new SessionAddress( ipAddr,
    session.port,
    session.ttl);
    } else {
    localAddr= new SessionAddress( InetAddress.getLocalHost(),
    session.port);
    destAddr = new SessionAddress( ipAddr, session.port);
    mgrs[i].initialize( localAddr);
    // You can try out some other buffer size to see
    // if you can get better smoothness.
    BufferControl bc = (BufferControl)mgrs[i].getControl("javax.media.control.BufferControl");
    if (bc != null)
    bc.setBufferLength(350);
    mgrs[i].addTarget(destAddr);
    } catch (Exception e){
    System.err.println("Cannot create the RTP Session: " + e.getMessage());
    return false;
    // Wait for data to arrive before moving on.
    long then = System.currentTimeMillis();
    long waitingPeriod = 30000; // wait for a maximum of 30 secs.
    try{
    synchronized (dataSync) {
    while (!dataReceived &&
    System.currentTimeMillis() - then < waitingPeriod) {
    if (!dataReceived)
    System.err.println(" - Waiting for RTP data to arrive...");
    dataSync.wait(1000);
    } catch (Exception e) {}
    if (!dataReceived) {
    System.err.println("No RTP data was received.");
    close();
    return false;
    return true;
    public boolean isDone() {
    //return playerWindows.size() == 0;
    return false;
    * Close the players and the session managers.
    protected void close() {
    for (int i = 0; i < playerWindows.size(); i++) {
    try {
    ((PlayerWindow)playerWindows.elementAt(i)).close();
    } catch (Exception e) {}
    playerWindows.removeAllElements();
    // close the RTP session.
    for (int i = 0; i < mgrs.length; i++) {
    if (mgrs[i] != null) {
    mgrs[i].removeTargets( "Closing session from AVReceive2");
    mgrs[i].dispose();
    mgrs[i] = null;
    PlayerWindow find(Player p) {
    for (int i = 0; i < playerWindows.size(); i++) {
    PlayerWindow pw = (PlayerWindow)playerWindows.elementAt(i);
    if (pw.player == p)
    return pw;
    return null;
    PlayerWindow find(ReceiveStream strm) {
    for (int i = 0; i < playerWindows.size(); i++) {
    PlayerWindow pw = (PlayerWindow)playerWindows.elementAt(i);
    if (pw.stream == strm)
    return pw;
    return null;
    * SessionListener.
    public synchronized void update(SessionEvent evt) {
    if (evt instanceof NewParticipantEvent) {
    Participant p = ((NewParticipantEvent)evt).getParticipant();
    System.err.println(" - A new participant had just joined: " + p.getCNAME());
    * ReceiveStreamListener
    public synchronized void update( ReceiveStreamEvent evt) {
    RTPManager mgr = (RTPManager)evt.getSource();
    Participant participant = evt.getParticipant();     // could be null.
    ReceiveStream stream = evt.getReceiveStream(); // could be null.
    if (evt instanceof RemotePayloadChangeEvent) {
    System.err.println(" - Received an RTP PayloadChangeEvent.");
    System.err.println("Sorry, cannot handle payload change.");
    System.exit(0);
    else if (evt instanceof NewReceiveStreamEvent) {
    try {
    stream = ((NewReceiveStreamEvent)evt).getReceiveStream();
    //DataSource
    ds2 = stream.getDataSource(); // this original cant be used now
    // ds is used to play video
    ds = Manager.createCloneableDataSource(ds2);
    // ds3 is used to record video
    ds3 = ((SourceCloneable)ds).createClone();
    // Find out the formats.
    RTPControl ctl = (RTPControl)ds.getControl("javax.media.rtp.RTPControl");
    if (ctl != null){
    System.err.println(" - Recevied new RTP stream: " + ctl.getFormat());
    } else
    System.err.println(" - Recevied new RTP stream");
    if (participant == null)
    System.err.println(" The sender of this stream had yet to be identified.");
    else {
    System.err.println(" The stream comes from: " + participant.getCNAME());
    // create a player by passing datasource to the Media Manager
    Player p = javax.media.Manager.createPlayer(ds);
    if (p == null)
    return;
    p.addControllerListener(this);
    p.realize();
    PlayerWindow pw = new PlayerWindow(p, stream);
    playerWindows.addElement(pw);
    // Notify intialize() that a new stream had arrived.
    synchronized (dataSync) {
    dataReceived = true;
    dataSync.notifyAll();
    } catch (Exception e) {
    e.printStackTrace();
    return;
    else if (evt instanceof StreamMappedEvent) {
    if (stream != null && stream.getDataSource() != null) {
    DataSource ds = stream.getDataSource();
    // Find out the formats.
    RTPControl ctl = (RTPControl)ds.getControl("javax.media.rtp.RTPControl");
    System.err.println(" - The previously unidentified stream ");
    if (ctl != null)
    System.err.println(" " + ctl.getFormat());
    System.err.println(" had now been identified as sent by: " + participant.getCNAME());
    else if (evt instanceof ByeEvent) {
    System.err.println(" - Got \"bye\" from: " + participant.getCNAME());
    PlayerWindow pw = find(stream);
    if (pw != null) {
    pw.close();
    playerWindows.removeElement(pw);
    * ControllerListener for the Players.
    public synchronized void controllerUpdate(ControllerEvent ce) {
    Player p = (Player)ce.getSourceController();
    if (p == null)
    return;
    // Get this when the internal players are realized.
    if (ce instanceof RealizeCompleteEvent) {
    PlayerWindow pw = find(p);
    if (pw == null) {
    // Some strange happened.
    System.err.println("Internal error!");
    System.exit(-1);
    pw.initialize();
    pw.setVisible(true);
    p.start();
    try {
    // make it wait so that video can start otherwise image will be null. u must call this method with a button
    Thread.sleep(2500);
    catch (Exception e) {
    e.printStackTrace();
    // Grab a frame from the capture device
    FrameGrabbingControl frameGrabber = (FrameGrabbingControl) p.getControl(
    "javax.media.control.FrameGrabbingControl");
    Buffer buf = frameGrabber.grabFrame();
    // Convert frame to an buffered image so it can be processed and saved
    Image img = (new BufferToImage( (VideoFormat) buf.getFormat()).
    createImage(buf));
    BufferedImage buffImg = new BufferedImage(img.getWidth(null),
    img.getHeight(null),
    BufferedImage.TYPE_INT_RGB);
    Graphics2D g = buffImg.createGraphics();
    g.drawImage(img, null, null);
    // Overlay curent time on image
    g.setColor(Color.RED);
    g.setFont(new Font("Verdana", Font.BOLD, 12));
    g.drawString( (new Date()).toString(), 10, 25);
    try { // Save image to disk as PNG
    ImageIO.write(buffImg, "jpeg", new File("c:\\webcam.jpg"));
    catch (Exception e) {
    e.printStackTrace();
    // this will record the video for a few seconds. this should also be called properly by menu or buttons
    record(ds3);
    if (ce instanceof ControllerErrorEvent) {
    p.removeControllerListener(this);
    PlayerWindow pw = find(p);
    if (pw != null) {
    pw.close();
    playerWindows.removeElement(pw);
    System.err.println("AVReceive2 internal error: " + ce);
    * A utility class to parse the session addresses.
    class SessionLabel {
    public String addr = null;
    public int port;
    public int ttl = 1;
    SessionLabel(String session) throws IllegalArgumentException {
    int off;
    String portStr = null, ttlStr = null;
    if (session != null && session.length() > 0) {
    while (session.length() > 1 && session.charAt(0) == '/')
    session = session.substring(1);
    // Now see if there's a addr specified.
    off = session.indexOf('/');
    if (off == -1) {
    if (!session.equals(""))
    addr = session;
    } else {
    addr = session.substring(0, off);
    session = session.substring(off + 1);
    // Now see if there's a port specified
    off = session.indexOf('/');
    if (off == -1) {
    if (!session.equals(""))
    portStr = session;
    } else {
    portStr = session.substring(0, off);
    session = session.substring(off + 1);
    // Now see if there's a ttl specified
    off = session.indexOf('/');
    if (off == -1) {
    if (!session.equals(""))
    ttlStr = session;
    } else {
    ttlStr = session.substring(0, off);
    if (addr == null)
    throw new IllegalArgumentException();
    if (portStr != null) {
    try {
    Integer integer = Integer.valueOf(portStr);
    if (integer != null)
    port = integer.intValue();
    } catch (Throwable t) {
    throw new IllegalArgumentException();
    } else
    throw new IllegalArgumentException();
    if (ttlStr != null) {
    try {
    Integer integer = Integer.valueOf(ttlStr);
    if (integer != null)
    ttl = integer.intValue();
    } catch (Throwable t) {
    throw new IllegalArgumentException();
    * GUI classes for the Player.
    class PlayerWindow extends Frame {
    Player player;
    ReceiveStream stream;
    PlayerWindow(Player p, ReceiveStream strm) {
    player = p;
    stream = strm;
    public void initialize() {
    add(new PlayerPanel(player));
    public void close() {
    player.close();
    setVisible(false);
    dispose();
    public void addNotify() {
    super.addNotify();
    pack();
    * GUI classes for the Player.
    class PlayerPanel extends Panel {
    Component vc, cc;
    PlayerPanel(Player p) {
    setLayout(new BorderLayout());
    if ((vc = p.getVisualComponent()) != null)
    add("Center", vc);
    if ((cc = p.getControlPanelComponent()) != null)
    add("South", cc);
    public Dimension getPreferredSize() {
    int w = 0, h = 0;
    if (vc != null) {
    Dimension size = vc.getPreferredSize();
    w = size.width;
    h = size.height;
    if (cc != null) {
    Dimension size = cc.getPreferredSize();
    if (w == 0)
    w = size.width;
    h += size.height;
    if (w < 160)
    w = 160;
    return new Dimension(w, h);
    public void record(DataSource ds) {
    Format formats[] = new Format[1];
    formats[0] = new VideoFormat(VideoFormat.CINEPAK);
    FileTypeDescriptor outputType =
    new FileTypeDescriptor("video.x_msvideo");
    Processor p = null;
    try {
    p = Manager.createRealizedProcessor(new ProcessorModel(ds,formats,
    outputType));
    } catch (IOException e) {
    e.printStackTrace();
    } catch (NoProcessorException e) {
    e.printStackTrace();
    } catch (CannotRealizeException e) {
    e.printStackTrace();
    // get the output of the processor
    DataSource source = p.getDataOutput();
    // create a File protocol MediaLocator with the location
    // of the file to
    // which bits are to be written
    MediaLocator dest = new MediaLocator("file://vvv.mpeg");
    // create a datasink to do the file writing & open the
    // sink to make sure
    // we can write to it.
    DataSink filewriter = null;
    try {
    filewriter = Manager.createDataSink(source, dest);
    filewriter.open();
    } catch (NoDataSinkException e) {
    e.printStackTrace();
    } catch (IOException e) {
    e.printStackTrace();
    } catch (SecurityException e) {
    e.printStackTrace();
    // now start the filewriter and processor
    try {
    filewriter.start();
    } catch (IOException e) {
    e.printStackTrace();
    p.start();
    try {
    Thread.sleep(10000);
    }catch(Exception e) { }
    p.close();
    filewriter.close();
    // stop and close the processor when done capturing...
    // close the datasink when EndOfStream event is received...
    public static void main(String argv[]) {
    //     if (argv.length == 0)
    //     prUsage();
    String[] a = new String[1];
    a[0] = ("192.168.0.45/4002");
    AVReceive2 avReceive = new AVReceive2(a);
    if (!avReceive.initialize()) {
    System.err.println("Failed to initialize the sessions.");
    System.exit(-1);
    // Check to see if AVReceive2 is done.
    try {
    while (!avReceive.isDone())
    Thread.sleep(1000);
    } catch (Exception e) {}
    System.err.println("Exiting AVReceive2");
    static void prUsage() {
    System.err.println("Usage: AVReceive2 <session> <session> ...");
    System.err.println(" <session>: <address>/<port>/<ttl>");
    //System.exit(0);
    }// end of AVReceive2
    so here the code. all messed up. coz i have just completed it and havent worked on interface or formatting this code properly (didnt have much time). but hope it will help. ask me if u have any questions. dont want others to have those basic problems that i had to face.

    u did a good effort for the JMF beginners i appreciate that....thanks i lot....i need you help in a project in
    which i have to connect to a d-link 950G IP camera and process that
    mpeg-4 stream (i know there are some problems in JMF and mpeg4) and show it over applet of JFrame.
    IP is 172.25.35.22
    Edited by: alchemist on Jul 16, 2008 6:09 AM

  • Upload image from server in jdev release2 11.1.2.4.0?????

    HI i am using jdev 11.1.2.4.0
    my requirments are
    1.upload image from server
    2.display image and edited by using editor page like paint.
    3.save that edited copy also
    i am new i jdev,is this requirements are done by jdev,please help,i dont have any idea,please help????

    Unfortunately upgrading to 10.8.2 messes up your previously configured steps and you can no longer rely on Java Preferences to define your JDK setup.
    What I suggest is doing this:
    1) Delete your current JDev installation + the system directory
    2) Ensure that the symbolic link as described in step 3 of the following link is still present and points to actual file
    3) Follow the steps in this blog: https://blogs.oracle.com/blueberry/entry/how_to_saddle_your_mountain ... to reinstall JDev.
    This should get you back up and running.
    CM.

  • Save imageSnapshot to Server

    Hello all.
    I am trying to make a little component that allows a user to take a picture using their webcamera and then save it to a server.  I have the application so far allowing the user to take a picture and its creating a bitmap.  I then have another button "Save" that then converts this bitmap into a Snapshot which i want to then upload but am having troubles doing this.  I can save it to the users desktop computer no problem.  Just cant upload =[
    My code is looking like this
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/mx" >
        <fx:Script>
            <![CDATA[
                import mx.controls.Alert;
                import mx.graphics.ImageSnapshot;
                import mx.graphics.codec.JPEGEncoder;
                import mx.graphics.ImageSnapshot;
                [Bindable] public var bitmap:Bitmap;
                public function takeSnapshot():void
                    var snapshot:BitmapData = ImageSnapshot.captureBitmapData(videoDisplay);
                    bitmap= new Bitmap(snapshot);
                    img.source=bitmap;
                //Web Cam Stuff
                private function videoDisplay_creationComplete():void {
                    var camera:Camera = Camera.getCamera();
                    if (camera) {
                        videoDisplay.attachCamera(camera);
                    } else {   
                private function saveImageToFileSystem():void
                    var jPEGEncoder:JPEGEncoder = new JPEGEncoder(500);
                    var imageSnapshot:ImageSnapshot = ImageSnapshot.captureImage(img, 0, jPEGEncoder);
                    var fileReference:FileReference = new FileReference();
                    fileReference.save(imageSnapshot.data, "img123.jpg");
            ]]>
        </fx:Script>
        <mx:VideoDisplay id="videoDisplay"
                         creationComplete="videoDisplay_creationComplete()"
                         width="320" height="240" autoPlay="true" x="15" y="28"/>
        <mx:Image id="img" x="343" y="28"/>
        <s:Button id="button" label="Take Screenshot" click="takeSnapshot()" x="15" y="276"/>
        <s:Button click="saveImageToFileSystem()" label="Save Image" x="135" y="276"/>
        <s:Label x="54" y="348" text="Label"  useHandCursor="true" buttonMode="true" mouseChildren="false"/>
    </s:Application>
    If anyone could help that would be great.  I want to use a PHP backend if possible

    Hi and thanks for the reply.
    I have made some good progress on this.  I now have the application taking a bitmap screenshot, allowing the user to save this image to their desktop computer and then allow them to search their desktop computer for a file to upload.  I have done this using the file reference as you suggested.
    My only problem however is that i dont want the user to have to save the image onto their computer and then find it to upload it using the .browser() function.
    Is there anyway possible to pass a file to that browse direct?
    My code is this -
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/mx" >
        <fx:Script>
            <![CDATA[
                import mx.controls.Alert;
                import mx.graphics.ImageSnapshot;
                import mx.graphics.codec.JPEGEncoder;
                import mx.graphics.ImageSnapshot;
                [Bindable] public var bitmap:Bitmap;
                public function takeSnapshot():void
                    var snapshot:BitmapData = ImageSnapshot.captureBitmapData(videoDisplay);
                    bitmap= new Bitmap(snapshot);
                    img.source=bitmap;
                //Web Cam Stuff
                private function videoDisplay_creationComplete():void {
                    var camera:Camera = Camera.getCamera();
                    if (camera) {
                        videoDisplay.attachCamera(camera);
                    } else {   
                private function saveImageToFileSystem():void
                    var jPEGEncoder:JPEGEncoder = new JPEGEncoder(500);
                    var imageSnapshot:ImageSnapshot = ImageSnapshot.captureImage(img, 0, jPEGEncoder);
                    var fileReference:FileReference = new FileReference();
                    fileReference.save(imageSnapshot.data, "img123.jpg");
                //Upload Stuff
                import mx.controls.Alert;
                private var fileRef:FileReference;
                private const FILE_UPLOAD_URL:String = "http://www.******/upload.php";
                private function init():void {
                    fileRef = new FileReference();
                    fileRef.addEventListener(Event.SELECT, fileRef_select);
                    fileRef.addEventListener(Event.COMPLETE, fileRef_complete);
                private function browseAndUpload():void {
                    fileRef.browse();
                private function fileRef_select(evt:Event):void {
                    fileRef.upload(new URLRequest(FILE_UPLOAD_URL));
                private function fileRef_complete(evt:Event):void {
                    Alert.show("Image has been uploaded", "Success");
            ]]>
        </fx:Script>
        <mx:VideoDisplay id="videoDisplay"
                         creationComplete="videoDisplay_creationComplete()"
                         width="320" height="240" autoPlay="true" x="15" y="28"/>
        <mx:Image id="img" x="343" y="28"/>
        <s:Button id="button" label="Take Screenshot" click="takeSnapshot(),init()" x="15" y="276"/>
        <s:Button click="saveImageToFileSystem()" label="Save Image" x="135" y="276"/>
        <s:Button x="229" y="276" label="Upload" click="browseAndUpload()"/>
    </s:Application>
    If you look at it the process is - Take Screenshot, which create the bitmap, Save Image which converts it into Snapshot and then lets the user save it to their computer, Upload which lets the computer browse their desktop to search for an image to upload.
    However i want to merge steps two and three together, so that the user Takes a Screenshot, which saves it as a bitmap, this can be repeated many times as it is now, but then whent hey are happy with the image, they should just click Upload, which will save the image as a SnapShot and then upload it directly, without them needing to save it and then find it again using the .browse()
    So my question really is,
         Is it possible to pass a file into the browse straightway ?  Mainly passing a snapShot thru ?
    Just so you know my php code looks like this
    <?php
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $fileName = $_FILES['Filedata']['name'];
    $fileSize = $_FILES['Filedata']['size'];
    $name = $_GET['extraVar'];
    $argh = $name.'.doc';
    move_uploaded_file($tempFile, "./" . $argh);
    ?>
    Thanks !

  • Applet write file on coming server without servlet

    Hi, I have an applet that needs to write a new file on the server that's LOADED FROM. Here are my questions:
    1) can the applet write this file WITHOUT using a servlet on the server side?
    2) if it's possible, could someone send me an example to explain how to do it?
    Thanks in advance, have a nice day

    1) can the applet write this file WITHOUT using a
    servlet on the server side?No,it can't. Well, on the server is not necessary to
    have a java servlet but you should have "something"
    that can receive your data, understand it and save it.
    A small PHP script is enough.
    Hope this help

  • Displaying an RTF document that contains images

    Hello,
    I am trying to display styled text that contains images. I thought the simplest way to do this was to save my documents as RTF documents, and display them through the JEditorPane. But, when the JEditorPane display the documents, the text is styled properly, but there are no images being drawn. Is the JEditorPane capable of displaying RTF files that contain images?
    My main objective is to display documents in Java that other people have created; so if there is some other small libraries that can do this. I would be interested. I need to display the documents in an applet, so I want the library to be small.
    Thanks
    Vance

    JEditorPane will render HTML and basic CSS with images.

Maybe you are looking for

  • Laptop advice

    I am looking for all the advice I can before buying a new laptop. My question is will the following specs work well with adobe products like Photoshop, fireworks and like programs. I don't play any games so that is not an issue. I do mostly web desig

  • DTW importing COGS Account in Sales Order

    What's the column of COGS Account in Sales Order template to import through DTW?

  • N8 Symbian Belle Product Codes

    I have had Nokia phones for twenty odd years , this has to be one of the most frustrating things I have come across. My current phone an N8 PC 059D012, it is not tied to an operator but am stuck with waiting for ages to upgrade to Belle because my pr

  • Howto to get the year timestamp in syslog and logadm files

    5.10 Generic_141414-10 sun4u sparc Howto to get the year timestamp in syslog and logadm We have to keep logs files for a long time, I was exploring logs in /var/adm/secure and noticed that log files over a year old did not have a year time stamp, the

  • Upgrading your trial site

    Hi I have built my website on business catalyst.  I have transferred the domain from Go Daddy and now gone into the site domains and all i can see is two trial versions - do i have to wait for it to be moved from Go Daddy or click launch site.  Tried