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.

Similar Messages

  • 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

  • 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 to Access ASP Info in Proxy server Environment

    I Have a Java Applet on a Web server outside and when I access the
    applet in my corporate office which has a ProxyServer I get "UnKnownHost Exception".
    I did used the "System.getProperties" methods giving the Proxy information and can pass through the Proxy Server.But that is not what I want,The Applet should get through
    the Proxy server and get the response from the ASP without using the "System.getProperties".
    IS THERE ANY WAY TO GET THE INFO. OF PROXY SERVER FROM THE CLIENT MACHINE ON WHICH THE APPLET RESIDES(PROXY HOSTNAME:, PROXY PORT)OR FROM THE BROWSER (IE/NETSCAPE)CAUSE THEY STORE THE PROXY INFO INTERNALLY--WHERE??? AND HOW DO I GET THAT?
    Thanks in Advance

    If you are using the Microsoft VM, and your applet is signed, you can use MS security to query the registry for the proxy server info.
    For example:
    com.ms.security.PolicyEngine.assertPermission(com.ms.security.PermissionID.REGISTRY);
    com.ms.lang.RegKey key = new com.ms.lang.RegKey(com.ms.lang.RegKey.getRootKey(
      com.ms.lang.RegKey.USER_ROOT,
      "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings",
      com.ms.lang.RegKey.KEYOPEN_READ);
    String proxyServer = key.getStringValue("ProxyServer");However, if your client is using the Java plugin, this will not work. The Java Plugin loads the proxy server information based on the browser preferences, but I haven't figured out how to retrieve that proxy information from the Plugin itself. Sometimes the javaplugin.proxy.auto.url system property is null, even if the browser (MSIE) is configured to use an auto-configuration script/url for the proxy server configuration. I can see in the Java Console that the plugin knows the auto-config url.
    Even if javaplugin.proxy.auto.url is not null, I don't know how to call the javascript function at that URL from within the applet to get the proxy server host name and port.
    Does anyone know how to get the proxy information from the plugin?

  • How to save applet in image(gif/jpeg) format

    Hi there !
    how to save applet in image (gif/jpeg) format. i have just gone through JIMI package where serilization is there ,WHERE U CAN SORE in image format ...........can anybudy help me out.........if possible then pleeez provide me some example.
    Thanks in advan...........

    I think that is possible because i have seen some commercial applets that do that.
    -http://www.izhuk.com/painter/
    -http://www.lawrencegoetz.com/programs/signature/
    Thses two saves the image in the server since applets cant write in the host they are running. Maybe it would be possible whit JFS, i don't know.
    For now I am trying to store an image draw in the applet on my server.
    My idea now is copying the image to a buffer or something, open a connection to the server and receive the image with a perl CGI.
    There is an example with text:
    -http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html
    I want to do something similar but with an image.

  • Can I save as pdf when printing from a Java applet on a webpage in Safari?

    I am trying to use a webpage that is running a Java applet. A dialog comes up that asks me, "Do you want to run this application?" The dialog also says, "This application will run with limited access that is intended to protect your computer and personal information." I select "Run". The applet generates an image I want to print.  There is a "Print" button on the applet.  I select "Print". A Security Warning dialog comes up that says, "The applet has requested access to the printer. Do you want to allow this action?" I select "OK".  The Print dialog comes up.  I choose the PDF button in the lower left corner. I choose "Save as PDF...". A second Print dialog comes up.  I input a title in the Save As box.  I choose Desktop in the Where box.  I do not change anything else and select the "Save" button. A dialog appears that says, "Print Error while printing." There is an icon with paper, a pencil, a ruler and a paintbrush on the dialog. 
    Is this an issue with Apple and Java security?  Does "run with limited access" mean I can't print and save as PDF? Should I upgrade to Mavericks?  It seems like others have not been happy with Mavericks and have had problems saving as PDF with Mavericks. How do I let Apple know about this error?  The error dialog is useless. 
    I am on a Mac running OS X 10.8.5 and Safari 6.1.2.  My Java version is 7 update 51.
    What other information can I provide to help solve the problem (if it can be solved)?
    Thank you for your help!

    Correction I would like to save as PDF/A-1b
    for archiving.
    http://www.adobe.com/enterprise/standards/pdfa/

  • Referencing a "locally installed" Java applet from a server-based HTML page

    How does one reference a "locally installed" Java applet from a server-based HTML page (i.e. via the applet, object, or embed tags)? I have seen references in documentation that this is possible, but I have not seen any examples. I have tried a few things, but nothing seems to be working.
    Some background...
    I'm working on a web site that aggregates Internet video. For many users, I would like the site to work "without" requiring Java to be installed (or any prompts, etc.). This version of the site allows users to stream videos directly over the Internet and does not require any sort of access to the local system.
    However, in addition, I have a download manager that can be installed on the local system. Currently, it's a Windows-based "service" that is always running in the background, downloading files, etc. (with plans to later support other OSes).
    My dilemma is trying to communicate between my web site running in the local browser (executing JavaScript code) and the download manager. I call this component the "gateway". I need the gateway to be able to do the following:
    1) Pass user credentials from the web browser UI to the download manager (so it can communicate with my servers).
    2) Check the status of downloaded videos
    3) Launch a local media player (such as Windows Media, QuickTime, etc.) (or perhaps tell the download manager to launch the media player).
    Under Windows XP, I have an ActiveX control that can do these things. It communicates with the download manager via reading/writing to a shared XML configuration file.
    Unfortunately, under Vista and IE7 Protected Mode, ActiveX controls have become very restricted and my gateway no longer works. As such, I am looking at using Java for the gateway (also giving me the additional benefits of supporting additional browsers and OSes).
    From my understanding, I believe I can created a "face-less" Java applet, whose methods can be called from JavaScript. Ideally, I'm thinking I could install the applet onto the local system at the same time the download manager is installed. This would give the applet the security permissions it needs to communicate with the download manager.
    Thanks for any help and suggestions!

    Hi,
    Put the .jar file and the .class file in the path mentioned in one of the aliases in the plsql.conf file like /images or create
    a seperate directory and create an alias like /applets "path" in the plsql.conf file.
    <html>
    <body>
    <applet code=com.chartapplet.chart.BarChartApplet
    codebase=/applets/
    archive=/applets/chart.jar width=300 height=200>
    <param name=background value="white">
    </body>
    </html>
    Hope this helps.
    Thanks,
    Sharmila

  • Print- Save as PDF from Java applet on a webpage in Safari

    I am on a Mac running OS X version 10.8.5 and Safari version 6.1.2.  I am using the website www.wordle.net, which uses a Java applet to create a Wordle. The applet has a print button.  The website FAQ says I should be able to save a Wordle as a PDF on a Mac.  When I try to do this I get a small dialog that simply says "Error whilte printing."
    Here is some of the system.log:
    Mar  4 16:57:54 Kroghs-iMac.local sandboxd[602] ([557]): java(557) deny file-write-create /private/var/folders/f0/c8r_ry6d4131x95phl6fv7kr0000gn/T/WebKitPlugin-f12Pu6/53 164c620f81b
    Mar  4 16:57:54 Kroghs-iMac.local java[557]: spawn_via_launchd() failed, errno=1 label=[0x0-0x96096].com.apple.ImageCaptureExtension2 path=/System/Library/Image Capture/Support/Image Capture Extension.app/Contents/MacOS/Image Capture Extension flags=0
    Mar  4 16:57:54 --- last message repeated 1 time ---
    Mar  4 16:57:54 Kroghs-iMac.local java[557]: ERROR: [ICCommandCenter launchAgent] - Failed to launch agent[1], status: -10810, url: 'file://localhost/System/Library/Image%20Capture/Support/Image%20Capture%20Exte nsion.app/'
    Mar  4 16:57:54 Kroghs-iMac.local java[557]:
              ***** Failed to launch Image Capture Extension.
    Mar  4 16:57:54 Kroghs-iMac.local java[557]: spawn_via_launchd() failed, errno=1 label=[0x0-0x97097].com.apple.ImageCaptureExtension2 path=/System/Library/Image Capture/Support/Image Capture Extension.app/Contents/MacOS/Image Capture Extension flags=0
    Mar  4 16:57:54 --- last message repeated 1 time ---
    Mar  4 16:57:54 Kroghs-iMac.local java[557]: ERROR: [ICCommandCenter launchAgent] - Failed to launch agent[1], status: -10810, url: 'file://localhost/System/Library/Image%20Capture/Support/Image%20Capture%20Exte nsion.app/'
    Mar  4 16:57:54 Kroghs-iMac.local java[557]:
              ***** Failed to launch Image Capture Extension.
    Mar  4 16:57:54 Kroghs-iMac.local java[557]: spawn_via_launchd() failed, errno=1 label=[0x0-0x98098].com.apple.ImageCaptureExtension2 path=/System/Library/Image Capture/Support/Image Capture Extension.app/Contents/MacOS/Image Capture Extension flags=0
    Mar  4 16:57:54 --- last message repeated 1 time ---
    Mar  4 16:57:54 Kroghs-iMac.local java[557]: ERROR: [ICCommandCenter launchAgent] - Failed to launch agent[1], status: -10810, url: 'file://localhost/System/Library/Image%20Capture/Support/Image%20Capture%20Exte nsion.app/'
    Mar  4 16:57:54 Kroghs-iMac.local java[557]:
              ***** Failed to launch Image Capture Extension.
    Mar  4 16:57:54 Kroghs-iMac.local java[557]: spawn_via_launchd() failed, errno=1 label=[0x0-0x99099].com.apple.ImageCaptureExtension2 path=/System/Library/Image Capture/Support/Image Capture Extension.app/Contents/MacOS/Image Capture Extension flags=0
    Mar  4 16:57:54 --- last message repeated 1 time ---
    Mar  4 16:57:54 Kroghs-iMac.local java[557]: ERROR: [ICCommandCenter launchAgent] - Failed to launch agent[1], status: -10810, url: 'file://localhost/System/Library/Image%20Capture/Support/Image%20Capture%20Exte nsion.app/'
    Mar  4 16:57:54 Kroghs-iMac.local java[557]:
              ***** Failed to launch Image Capture Extension.
    Mar  4 16:57:54 Kroghs-iMac.local java[557]: spawn_via_launchd() failed, errno=1 label=[0x0-0x9a09a].com.apple.ImageCaptureExtension2 path=/System/Library/Image Capture/Support/Image Capture Extension.app/Contents/MacOS/Image Capture Extension flags=0
    Mar  4 16:57:54 --- last message repeated 1 time ---
    Mar  4 16:57:54 Kroghs-iMac.local java[557]: ERROR: [ICCommandCenter launchAgent] - Failed to launch agent[1], status: -10810, url: 'file://localhost/System/Library/Image%20Capture/Support/Image%20Capture%20Exte nsion.app/'
    Mar  4 16:57:54 Kroghs-iMac.local java[557]:
              ***** Failed to launch Image Capture Extension.
    Mar  4 16:57:55 Kroghs-iMac.local java[557]: Printing failed because PMSessionBeginCGDocumentNoDialog() returned -108.
    I've removed the Adobe plug-ins from /Library/Plug-Ins
    Print->Save to PDF works from Safari when I am on a regular webpage.
    Print->Save to PDF works from Pages
    Help!  I want to make Wordles for the teachers at my kids school for Teacher Appreciation Week.

    YES!!!!!!!
    I was pulling my hair out last night over this. I noticed the Find function was not working properly. I KNEW there was something in the PDF and Preview was not showing it. I spent 2 hours trying to find someone with a similar Find function problem, but could not find much. Also, it could not copy and paste text. I KNOW it worked before because I had taken notes on this particular PDF and had copy and pasted whole paragraphs for myself into Pages. Which is what got me searching online tonight.
    I re-downloaded the same PDF. When first opened in Preview, the Find and copy/paste functions worked. Same thing in Acrobat reader and Acrobat Pro. After confirming this, I re-opened it in Preview, highlighted some text and closed. It asked to Save Changes and I did. I immediately re-opened it, and guess what? Find no longer works and neither does copy/paste. Just to be sure, I tried re-opening in Acrobat reader and Pro; same thing. No copy/paste, corrupted Find feature. Well, copy/paste sort of functions, its just that it pastes a square with an alien head in it that says "Private Use 100000 Plane 16".
    And finally, on some PDFs that have not even been saved in Preview, the Find function is not working properly also. It happened on the re-downloaded PDF I just talked about. It finds many instances of the word, bit the left and right arrows next to "Found on X# Pages are greyed out and do not move through the document. Once I go to the left pane that displays page thumbnails and click on a few different ones, THEN it starts working.
    So yes, Apple, Preview is corrupting PDF files upon save, AND it is not working properly on other files. Please fix this. PLEASE.
    And my specs are the same as Gary; iMac 27 inch Late 2009, Yosemite 10.10.1. Is ANYONE else having this issue with a different Mac?

  • Wrong image refresh in java applet AND Windows 7

    I'm managing since few days a java applet that takes an image from an industrial product and shows it in a browser (simple web server).
    There is following issue: the image is not correctly loaded and refreshed in its own window if just opened but only if the applet is running on Windows 7. The issue is solved as soon as I reduce the window to icon (minimize) and then resize it. I'm looking into java documentation on how to manage the image rendering, maybe I have to override some update or redraw method more, but it is taking time and I'm still learning. NOTE that the window opened does show the issue only when the windows size is not completely shown in the monitor.
    Meanwhile I'm wandering if some of you faced and solved similar problem.
    Thank you in advance,
    Elena

    Thank you Nitin for your quick reply!
    These are the calling of the functions in the code. As you can see, before to show the image, we are managing a zoom/unzoom by mouse wheel and an addition of writings data on the image itself. All is working fine except on W7:
    public void paint(Graphics g)
         //System.out.println("[ImageFrame::paint my paint!!!]");
         this.PaintImage(g);
    public void update(Graphics g)
         // System.out.println("[ImageFrame::update]");
         this.repaint();
    public void PaintImage(ImageInfo imageInfo, float fps)
         if (imageInfo != null)
              if (this.getImageInfoRef() == null){
                   this.setVisible(true);
              this.setTitle("Image Viewer (" + imageInfo.bufferedImage.getWidth() + "x" + imageInfo.bufferedImage.getHeight() + ") ");
              this.resizeImageFrame((int) (imageInfo.bufferedImage.getWidth() * zoomFactor), (int) (imageInfo.bufferedImage.getHeight() * zoomFactor));
              this.lastFps = fps;
              this.setImageInfoRef(imageInfo);
              //System.out.println("this.getWidth(): " + this.getWidth() + " this.getHeight(): " + this.getHeight() + " zoomFactor: " + zoomFactor);////
              this.PaintImage(this.getGraphics());
    public synchronized void PaintImage(Graphics g)
         ImageInfo locImageInfo = getImageInfoRef();
         if (locImageInfo != null)
              try
                   this.resizeImageFrame((int) (locImageInfo.bufferedImage.getWidth() * zoomFactor), (int) (locImageInfo.bufferedImage.getHeight() * zoomFactor));
                   BufferedImage bufferedImage = this.resizeBufferedImage(locImageInfo.bufferedImage, zoomFactor);
                   this.overlayCodeInfo(bufferedImage, locImageInfo.decInfoStruct, zoomFactor);
                   this.overlayPointerInfo(bufferedImage, locImageInfo.scaling, zoomFactor, this.crossX, this.crossY);
                   this.overlayFrameRateInfo(bufferedImage, this.lastFps);
                   Image img = Toolkit.getDefaultToolkit().createImage(bufferedImage.getSource());
                   boolean retdraw;
                   retdraw = g.drawImage(img, frameUpperBondarySizeX, frameUpperBondarySizeY, this);
              catch (Exception ex)
                   System.out.println("[ImageFrame::PaintImage] Exception: " + ex);
    Thank you again
    Elena

  • 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.

  • Upload Images java applet

    Hello,
    We are trying to create a java applet that will be hosted in an ASP .NET-based web application, to help a user select an image file from the client computer (such as jpg, gif or another supported image type). After that we want to do jpeg-encode the image on the client side (within the applet) and upload the result to the server.
    After using FileDialog's show() method to display the Open dialog and allow the user select the image file, we try to get the image with getImage("file://" + selectedDirectory + selectedFile).
    The problem is that the applet cannot (by default) read the image: getImage throws a AccessControlException with denying SocketPermission.
    We tried to sign the applet by using jarsigner with a certificate generated with keygen (so with an unofficial certificat), for tests purposes only. However, even when the applet's jar is signed, the same exception is thrown and the dialog asking the user whether or not he or she would allow this applet to run (since it was signed with an unoficial certificate) does NOT appear, as we expected.
    One more thing (may not be related): When removing the Name=... attribute from the APPLET tag (and only keeping class="the.class" and archive="the.jar") the applet won't load unless the HTML page is open directly from Windows Explorer (it won't load when load as http://localhost/testpage.htm).
    Thanks for any suggestions you may have.

    However, even when the applet's jar is signed, the same exception is thrown ...you must have done something wrong, try doprivileged if your code is called by untrusted code
    like javascript.
    You might try non depreciated html and have a go at the htmlconverter in the jdk bin directory to
    convert your html pages.
    Signing applets:
    http://forum.java.sun.com/thread.jsp?forum=63&thread=524815
    second post and last post for the java class file using doprivileged
    Uploading using multipart/form-data:
    http://forum.java.sun.com/thread.jspa?threadID=530445&tstart=270
    Still problems?
    A Full trace might help us out:
    http://forum.java.sun.com/thread.jspa?threadID=656028

  • How to update content of a file on server using a Java Applet?

    Hi,
    I'm new to Java, and I have a task now to overwrite a text file on a server using an applet. I have written a piece of code which compiles but doesn't work. Can you please take a look at the code or give me another way to do it?
    Thanks.
    Code:
    import java.applet.Applet;
    import java.io.*;
    import java.net.*;
    public class test2 extends Applet{
    public void init() {
    StringBuffer buf = new StringBuffer();
    try {
         String output = "this is some string";
         URL aUrl = new URL (getCodeBase().toString() + "test.txt");
         System.out.println(aUrl);
         URLConnection con = aUrl.openConnection();
         con.setDoOutput(true);
         PrintWriter out = new PrintWriter( new BufferedWriter( new OutputStreamWriter(con.getOutputStream())));
         out.println(output);
         out.close();
    catch (MalformedURLException mue) {
         System.out.println("improper url");
         mue.printStackTrace();
    catch (IOException e) {
         System.out.println("io exception");
         e.printStackTrace();
    }

    Ram.ViSolve wrote:
    869975 wrote:
    Thanks. I knew there would be a security issue, but I do not have sufficient knowledge to get around it. If you have a reference how to configure a server please post it here.You need to create Signed Applet. Because normally applets have some restriction to access the files in the client machine. Signed applets overrides the restriction.
    To know more, Read [url http://192.9.162.55/developer/onlineTraining/Programming/JDCBook/signed.html]Signed Applet
    No. Our OP wants to write to the server, not to the client! And to achieve this from an applet, you don't need it signed, iff the server is the machine from where the applet was downloaded in the first place. You only need to use a mechanism that allows you to write to servers, which HTTP is not. FTP, on the other hand, if setup properly can do it. So instead of trying to write using an HttpURLConnection (OP's attempt), you would use an FTP client library. FTP here is just an example and probably not the best way. Another option is to use some servlet or PHP or ASP on the server side and the applet will sumbmit the changes to that code on the server, which in turn will write to the file. The idea is that you need some 'partner code' on the server, be it the FTP server or the servlet/PHP/ASP code. None of this requires the applet to be signed.

  • Having problem with importing images to a java applet in web broswer

    I'm creating a mini 2d game just for fun and I am running it as a applet with the JApplet class.
    This is my html file.
    <html>
    <body>
    <applet code=ambiDexApplet.class name=ambiDexApplett archive=ambiDexApplet.jar
         width=640 height=480>
         <param name="Player" value="Player.class">
         <param name="Actor" value="Actor.class">
         <param name="Tail_Bead" value="Tail_Bead.class">
         <param name="Block" value="Block.class">
         <param name="Morphable" value="Morphable.class">
         <param name="Item" value="Item.class">
         <param name="GameObject" value="GameObject.class">
         <param name="leftImg" value="Player_Left3.gif">
         <param name="rightImg" value="Player_Right3.gif">
         <param name="img1" value="bgImgFinal.jpg">
         <param name="img2" value="Block_Tower2.gif">
    </applet>
    </body>
    </html>However every time i try to run the program i get the following error when i open the java console.
    java.security.AccessControlException: access denied (java.io.FilePermission Images\Player_Left3.gif read)
    at java.security.AccessControlContext.checkPermission(Unknown Source)
    at java.security.AccessController.checkPermission(Unknown Source)
    Obviously, the applet is not letting me read the image files. By the way, the .class files and the image files are all in same directory. So can anyone help me please?

    Unfortunately, yes--I've tried it that way over and over, and every other way I could think of.  The files are all in one folder, and I've converted the raw files to both tiffs and jpegs.  I even tried converting them to jpegs at the final pixel dimensions.  Each folder that I have used only contains one type of file, and they are all part of the same sequence and sequentially numbered.  I have even tried renumbering the files with numbers first, numbers last, numbers only, moving underscores.  I moved the files from my external hard-drive to the desktop ... I have a lot less hair than I had only a few days ago!
    I've looked at a few other tutorials that outline the same sequence of steps, and tried them over and over, and then changing one step at a time to make sure that it was not a single step that caused the problem.
    The thing that is really bugging me is that it works fine if I use the different approach of using the place command instead. 
    Anyway, thanks for all of your time.  It's going to be a lot simpler to just stick with 'place' command and I will likely do that, but I tend take things like this as a challenge.  I like to know WHY it won't work for me.  Sometimes it seems that there is just no logical explanation!
    Stuart

  • JDK 1.4.2 java applet image printing on mac safari

    Hi there,
    I'm trying to implement printing inside java applet using javax.print package. I read an article somewhere about the package not working perfectly under mac, and a workaround is to use the old java.awt.print to get the print services, then use the DocPrintJob to print.
    The SimpleDoc I use for capturing the image that I need to print works fine, and the printServices are there. The problem I have is it's giving me an 'invalid flavor' exception when clicking 'Print' on popup PrintDialog.
    It seems that the mimetype is what's causing the problem, as the printer's supported mime type is "application/x-java-jvm-local-objectref". (note that, on PC the printing works fine, with Doc flavor mimetype as image/png and the image I need to print in png format). I tried switching the flavor to SERVICE_FORMATTED.RENDERABLE_IMAGE, printing an ImageDoc class which implements Doc and RenderableImage, but 'invalid flavor' exception still occurs.
    I don't know much about printers on Mac, so I'm not sure what I can do about it, is it something that can be controlled from the Applet or it's something that the user has to set in the system - the Applet can only warn the user and tell the user to do the configuration.
    Thanks in advance!

    SwingUtilities.updateComponentTreeUI() works by first updating the UI of the given component, and then updating the component's children (and their children). So first it will update the JToolBar's UI (which installs the appropriate borders on its buttons), and then it will update each button's UI (which subsequently installs its own default border onto the button, undoing JToolBar's border installation, thanks to the bug mentioned previously).
    Another possible work-around for this problem would be to write your own updateComponentTreeUI() method that updates the child components' UI's before updating the parent component's UI:public static void newUpdateComponentTreeUI(Component c)
         updateTreeUIs(c);
         c.invalidate();
         c.validate();
         c.repaint();
    private static void updateTreeUIs(Component c)
         Component[] children = null;
         if (c instanceof JMenu) children = ((JMenu)c).getMenuComponents();
         else if (c instanceof Container) children = ((Container)c).getComponents();
         // Children first...
         for (int i=0; children != null && i < children.length; i++)
              updateTreeUIs(children);
         // Parent last...
         if (c instanceof JComponent) ((JComponent)c).updateUI();
    }Not sure if this will present any other conflicts though.

  • 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

Maybe you are looking for

  • Exception while running a test file as JUNIT test case

    Hi, I am trying to build a code using Eclipse to generate an "ear" file that can be used for deployment. The ear file is generated successfully but the build is not successful as the following exception is thrown while debugging a junit test case: ja

  • Logic has randomly ....

    randomly started putting the lyrics ABOVE the staff and now below. I can't work out why. Anyone have any ideas? I've had a fiddle with the settings but can't work out why.

  • HT4628 my wi-fi connection changes to another network when ever my macbook pro restarts

    I've check remember network, my private network, but every time I close my laptop or restart it the wi-fi network changes

  • Timer in JSF

    hi.. i am in need of using a timer in my JSF page. The requirement is similar to that of online Examination where time decrements.... will i be able to use a timer in my JSF page... Help Me out... Thanksssssss

  • Write Off Several Commitment Balances

    The case is that we have lots of deposit invoices of various customers amounting not more than 5 Rupees, and the commitment balance is due to be applied on transactions. One way to do this is that I would create lots of transactions for each and ever