How to create a jpeg of a Applet

i've done an applet that print something, i want that the user can save on his pc the applet in a jpeg, or other format.

     public void start() {
          // TODO Auto-generated method stub
          getContentPane().add(BorderLayout.CENTER, new JPanel()).setBackground(Color.GREEN);
          getContentPane().add(BorderLayout.SOUTH, new JLabel("hahdfhakldf"));
          setVisible(true);
          pack();
          BufferedImage image =
               new BufferedImage(
                    getWidth() ,
                    getHeight(),
                    BufferedImage.TYPE_INT_RGB);
          Graphics2D g2 = image.createGraphics();
          paint(g2);
          g2.translate(256, 0);
          g2.dispose();
          try {
                         ImageIO.write(image, "jpg", new File("awtImage.jpg"));
                    } catch (IOException ioe) {
                         System.out.println(ioe.getMessage());

Similar Messages

  • How to create a frame in a applet?

    Dear All,
    How to create a frame in a applet?
    Thanks in advance
    Kityy

    You can't add a Frame/JFrame to an Applet/JApplet.
    An Applet/JApplet has its origins in the class Panel/JPanel.
    So, if you make your Applet to an application you
    can easily do that by putting your Applet "above" a Frame.
    Maybe you can archieve your goals with some Panels?!

  • Best IDE and how-to create HTML for a swing Applet

    Can you help me out? I've been using, and teaching with the old Symantec VisualCafe product from long, long, ago. It still works fine & I can even use it to build JFC/Swing Applets etc. But a few things have occurred. For one, a way back, Symantec sold VisualCafe to WEBGAIN - who now has gone out of business and sold it to a company called TOGETHERSOFT - who doesn't support it any longer.
    This isn't really a big deal to me, because I can still build and deploy applets that are pre-swing easily enough. (as can my students)
    HOWEVER... I'd like to be running with the LATEST Java (I think it's 1.4.01) and I'd LIKE to use whatever is the best development environment I can use - especially one I can recommend to my students. Do you know what that should be?
    What's more, I'd still like to take some JFC/Swing created applets (even if compiled with the older VisualCafe IDE) and generate the HTML to allow 1.4 enabled browsers to run them (this is the case for the schools versions of Explorer and Netscape). Now, the HTML I have INSTALLED for the students used the HTML converter - back in 1.2 to produce the HTML at the bottom of this. This code no longer works now with current browsers. Do you know HOW one makes a jfc/swing compiled applet run on the latest browsers?
    Any help or direction you can give would be appreciated.
    thanks,
    Bobby Berns
    [email protected]
    <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    WIDTH = 756 HEIGHT = 396 codebase="http://java.sun.com/products/plugin/1.2/jinstall-12-win32.cab#Version=1,2,0,0">
    <PARAM NAME = CODE VALUE = "lottery.class" >
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.2">
    <COMMENT>
    <EMBED type="application/x-java-applet;version=1.2" java_CODE = "lottery.class" WIDTH = 756 HEIGHT = 396 pluginspage="http://java.sun.com/products/plugin/1.2/plugin-install.html"><NOEMBED></COMMENT>
    </NOEMBED></EMBED>
    </OBJECT>
    <!--
    <APPLET CODE = "lottery.class" WIDTH = 756 HEIGHT = 396 >
    </APPLET>
    -->
    <!--"END_CONVERTED_APPLET"-->

    Bobby,
    It's been a while since I've used the HTML Converter, but if I had to guess I'd say you need a newer version than what you have. Also, doesn't the converter allow you to choose which JDK you want to use (in which case you could select 1.4)? Again it's been a while so bear with me. Another option would be to put all the Swing classes into a .jar file (typically called swingall.jar) on your server and include that file as an attribute in your applet tag like this:
    <APPLET CODE="yourApplet.class" ARCHIVE="swingall.jar">
    This way you don't have to use the Java Plug-in, however the initial download time of the .jar file can be significant.
    As for an IDE, I've always been happy using a text editor like UltraEdit. However, I've heard good things about Forte, and hey, it's free!
    Regarding Christina's post, that solution will only work if the Applet does not use Swing components (and Bobby specifically said it does). By using the <OBJECT> and <EMBED> tags, rather than the <APPLET> tag, you force the browser to use the Java Plug-in (rather than the browser's default JVM).
    Hope that helps,
    - Sheepy

  • How to create a jpeg from frame?

    I have several short clips in hd from my digital camera. Can I create some jpegs from them within QT Pro? How? I know how to do it if I import the clips into iMovie 6, but since the footage is in hd, I thought maybe I could get a higher quality jpeg image if I can create it directly.

    Nevermind. Found answer here: https://discussions.apple.com/message/1956126#1956126

  • How to create a digital signature formy Applet?

    who can tell me how to create a digital signature for my applet? i want details of the process, because i know nothing about it. Thank you very much!!!

    http://java.sun.com/docs/books/tutorial/security1.2/apisign/gensig.html

  • How to create a browse button in applet

    Hi All,
    Need another help...
    I want create a Browse Button in java applet frame such that if I click on that button, I can pick a file from any folder of my machine.
    Is there any way to do so? If yes, can you give me a small code as example.
    Regards,
    Uji

    Hey Ujjal,
    I know it's late and I don't know if you're still having this issue but maybe this can be helpful to the next person who has it. As was already said, I think you should probably consider doing this project as an application rather than an applet to avoid file access permission problems. That said, here's how I would do it (since no one has answered your question directly):
    First this class should extend JFrame or some other window class
    Next create a file object (it's static so it can be accessed by anonymous classes later):
    private static File myFile = null;Then, inside the appropriate method (probably something like init() or main()), make the button and give it some functionality with an anonymous MouseListener:
    JButton myBrowseButton = new JButton("Browse");
    myBrowseButton.addMouseListener(new MouseAdapter(){
        // an anonymous MouseAdapter
        public void mouseClicked(MouseEvent e){
            ...now in here you'll want the code to make a JFileChooser in a dialog window
            // create a dialog window
            final JDialog myChooserDialog = new JDialog();
            myChooserDialog.setTitle("Browse");
            // an anonymous JFileChooser
            JFileChooser myFileChooser = new JFileChooser(PATH){
                // an anonymous instantiator to set the text of the select button
                { setApproveButtonText("Select"); }
                // what to do when the user clicks select
                public void approveSelection(){
                    // you might want to make sure the selected file is valid before this step
                    myFile = getSelectedFile();
                    myChooserDialog.dispose();
                // what to do if the user clicks cancel
                public void cancelSelection(){ myChooserDialog.dispose(); }
            ...add the chooser to the dialog and make it visible
            myChooserDialog.add(myFileChooser);
            myChooserDialog.setVisible(true);
            myChooserDialog.pack();
    });Now add the button to the frame and make it visible
    add(myBrowseButton);
    setVisible(true);
    pack();A few notes:
    1) Replace the word PATH with the path to the directory you want to browse (e.g. "." the current working directory)
    2) Make sure all of that code except for private static File myFile = null; goes into a method and isn't just floating around
    3) If ANY of this was confusing then go D.A.F.T (Do A Fecking Tutorial!)
    good luck!
    pieman

  • How to create a jpeg of one frame

    I tried creating a freeze frame but it won't allow me to drag that frame into iPhoto. How can I grab an still image and make it a jpeg or other image format?

    Place the playhead on the frame you want to export. Go to File->Export->Using QuickTime Conversion. In the export window, choose Still Image from the Format menu and use the Option menu to choose the file type (.jpg, .png, .psd, etc.).
    -DH

  • How to create a jpeg slideshow.

    With a lot of help I have now created a slide show with captions. However when I export the slide show I get only pdf format. I need jpeg so I can stream the file to my dvd player to see on the television.
    I finally found a way to export to jpeg but the captions do not follow and I think that is because I export from the Collection under LIBRARY instead of the SLIDESHOW  to avoid the pdf format.  I am sure there is a path somewhere to export a complete slideshow in jpeg format. Can anyone help with this?
    Thanks for any help,
    Ray Zachary

    Thanks for your quick response. Unfortunately, The Export JPEG Slideshow command does not appear in any menu whether I am in the Slideshow module or the Library module. I thought this type of command existed when I built a slide show in the past. However, it does not seem to be available now.  Is there a preference or other trigger that would cause this item to either be there or not be there?
    Ray Z.

  • How to create uncompressed Jpegs

    I want to post photos on Alamy and they request uncompressed jpeg files, what are they and how do I save my photos as this in Photoshop CS5. I use a Panasonic G2 which takes 6 meg Jpegs but I need much larger files.
    thanks for any help

    You are, but it's not really obvious...
    There's a very old terminology, dating back to scanning film, in which images are spoken of in megabytes, as though they're RGB and 8 bits per color...
    Basically, multiply your width in pixels x height in pixels x 3 bytes per pixel and you get the "standard old school" megabyte value.
    For example, 4000 x 3000 x 3 = 36 megabytes from your camera.
    -Noel

  • How can you create a jpeg from video in imovie 13?

    In imovie11 you could hit share, convert using quicktime, and then select mov to jpeg or gif.  that option is not available in imovie13?  Anyone know how to create a jpeg or gif in the new imovie?

    When you say you would drag the image itself into the Swatch Palette and it would show the image itself? How would then use this swatch? Can you give an example of what you would apply a jpeg to as a swatch? The only palette that I can think of off the top of my head that you can drag a jpeg into and have the icon appear as the jpeg is the Symbols Palette. Is is possible that you were using the Symbols Palette in the past and not the Swatch Palette?

  • How to create Chart within a web page NOT as seperate page?

    Hi, I am using JCharts and am trying to figure out how (or if it is even possible) to create a chart and then place it in a web page. All the examples I've seen show you how to create a JPEG of the chart and then link to this image from your web page. Is it not possible to surround the JPEG chart with other HTML so that I can keep my web page logo and menu etc on the same page as the chart?
    I can't find any examples which show how to surround your images with HTML as JCharts creates a JPG file and returns that in the Http Response e.g. "ServletEncoderHelper.encodeJPEG13(axisChart, 1.0f, response);".
    My environment is Java 1.4.2, Struts and Tomcat 4.1.30.
    Is there a way of drawing charts directly into a web page rather than displaying them on a seperate page as an image file?
    many thanks in advance,
    James.

    Hi Hatton,
    in html, there exists an img-tag. this tag contains a parameter called src. And if you want to embedd an image in your html-page, you will put the source of the image you want to display to the src-parameter. The same with servlets or java server pages. For the browser it doesn't matter where the html comes from. it doesn't matter if it has to be generated by an servlet-container like tomcat. So you write a servlet, which will create an image and make it accessible to your servlet container and then insert an tag like
    <html>
    <body>
    <img src="http://yourdomain/servlet?param=value" width=aNumber height=aNumber>
    </body>
    </html>This can be done because servlets can be configured to response with images which can be created by java2d or something else...
    I hope, this will help you...

  • How to create SSD in jcop 2.4.2.R2

    Hi All,
    Can anyone please help in understanding how to create a supplementry security domain in java card. Am creating a dummy applet and trying to uplad it & install it as a security domain with the following params. But unfortunetly am not successful in it. So please guide how to create an SSD & extradite an applet into it.
    I have followed the steps mentioned in the link : Install Applet in new Secure Domain
                                                                               How can I create a new Security Domain ?
    Select
    upload -c -b 250 "sc.cap"
    install -i A0000015111213 -s -b -e -q C90145 A00000151100 A0000015111213
    But my istall is failing with an condition not satisfied error.
    And please let me know whether there is a way to know that whether my card supports extradition or not.
    Please help me. Its urgent.
    Thanks in advance.

    Hello Emadina
    You need a web service reference in your Management Agent Extension code to get access to the exposed functions.
    And you not only need functions to create/modify/delete objects, you also need a function to read the objects from the custom data source for two reasons:
    a) to be able to join your existing objects
    b) for confirming imports.
    I think the best point to start your own Extensible Management Agent extension is the following link:
    http://msdn.microsoft.com/en-us/library/windows/desktop/hh859566(v=vs.100).aspx
    Cheers, Henry

  • How to create a browser to view JPEG files?

    Hi people,
    just wondering if anyone knows how to create a simple browser to view JPEG or some other image files?...Is there e.g. or tutorial provided by Sun on this...
    AG

    Sure, the Java Tutorial duscusses working with ImageIcons in an applet (or application) here:
    http://java.sun.com/docs/books/tutorial/uiswing/misc/icon.html
    The IconDemoApplet example is just such an image browser. Cheers,
    Chris

  • How to create 2 or 3 links URL in a jpeg ?

    How to create 2 or 3 links URL in a jpeg ?
    Do i use photoshop ?
    Thank you

    Images cannot contain links. All that stuff is done in the web page source code, e.g. using image maps, interactive SVGs or JavaScripts that track coordinates and respond accordingly. You will have to use a web authoring tool like Muse or Dreamweaver to produce such stuff, but since you seem to be a complete beginner, I strongly urge you to read up at least on some basic stuff about HTML, CSS and how the web ticks in general or you'll be forever lost.
    Mylenium

  • How to create an applet that shows a pdf as non-editable.

    Hi friends,
    Does any one know how to create an applet that shows a pdf document (should make that pdf a non-editable one) while clicking a link.Its urgent for me as I have to complete this one tomorrow itself...please help me...
    I am able to view the pdf document but that cannot be make a non-editable one.
    Can anyone gave me the code for that one....please I am not very much good in Java.

    PDF is a proprietary format and Java doesn't support it by default. Are you using a 3rd party tool to create the PDF? If so, you need to review the developer docs to see how to make the document non-editable. Frankly, I don't see why you're using an Applet to view a PDF in the first place. What exactly are you trying to do. I'm confused.

Maybe you are looking for

  • Need a program name for a Batchjob

    Hi Folks, In our current process, the deliveries are taken from picking duelist (VL06O)and the transfer order is created manually. Now we want to automate this process. I know that it can be done by a batch job. Could some one tell me the program tha

  • NVidia's new 197.16 driver release

    nVidia has just released the new 197.16 driver for most of their mobile GPUs. Wondering if anyone has upgraded yet, is the update good or bad and has anyone had any issues with the new driver?  The last driver update to the 195.62 had some overheatin

  • Hp dl380 g4 help !!!

    Hi all  Just today when I visited my server rack, my hp dl380 g4 was running its fans at full speed, so I powered down the server open it up make see if any hardware issues. I am getting led's errors on my motherboard here is the list: B1 IE NM These

  • My iTunes / iPod is set to "sync only checked..." occasionally when I connect it has changed to "manually manage..."  Why and more importantly, how do I stop it doing this?  Thanks.

    So far everytime this happens, I have to let iTunes wipe the iPod before it will revert to how I want it.  Frustrating!

  • OS needed

    My windows updates wont update ( at 97 atm), I asked microsoft support, he then checked my computer personally via some software that gave him the ability to control my pc from where he was. He could see no solution after trying everything and told m