Moving two seperate images in an applet

Hi i am trying to move two seperate images on an applet. these images are two random cards from a pack of playing card, ie king,jack, queen etc..
i can get both images moving at the same time but i want i want to do is to animate the movement of one image and when it raches a certain point onscreen, the other image moves to a different position onscreen and i should end up with both card images onscreen at different positions.
here is the code for the part in which the applet draws the image to the graphics object:
public void run()
        long tm = System.currentTimeMillis();
         while(Thread.currentThread() == t)
             repaint();
             try
                 tm += delay;
                 Thread.sleep(Math.max(0, tm - System.currentTimeMillis()));
                 //increment frame so that image moves 4 pixels at a time
                 f1 = f1 + 4;
                 f2 = f2 + 5;
                 f3 = f3 + 2;
                 f4 = f4 + 2;
             catch(InterruptedException e)
                 break;
    public void stop()
        t = null;
    public void update(Graphics g)
        //code that generates 5 random card and animate them onscreen.
        Dimension d = size();
        int w = cards[r1].getWidth(this);
        int h = cards[r1].getHeight(this);
        if(f1 <= 100)
            // Erase the previous image
            g.setColor(getBackground());
            g.fillRect(0, 0, d.width, d.height);
            g.setColor(Color.black);
            g.drawImage(cards[r1], f2, f1, this);  //co ordinates
            if((r1 != r2) && (f1 == 100 ) && (f3 <= 300))
                g.drawImage(cards[r2], f4, f3, this);  //co ordinates
        //g.drawImage(cards[r2], f4, f3, this);  //co ordinates
    }Has u can see from the above code. all 52 card images are stored in an array. I use a random function to generate a random image from the array, in this case two random images.
i have used if statements that tell me when to stop the animation of an image and when to start the next image for animation using the f1,f2,f3 etc.. these are used for the co ordinates of the actual images.
i increment them each time the applet is run from within a Thread.

Sounds like you just need a little swing(or awt if you're using "old java")
http://java.sun.com/docs/books/tutorial/uiswing/mini/index.html
BorderLayout might be useful. Be aware that it can be tricky to switch out swing components and you may need to validate the container.
Also, be aware that a "Frame"(JFrame) in java are what you would call a window and that a "Panel"(JPanel) in java is basically just an area that contains components, kinda like a <div> or <span> in html.

Similar Messages

  • Putting two separate images side by side in the same document

    Hello
    I'm new to the community and hope I'm posting this question in the right area.
    I've downloaded the 30 day free trial of Photoshop CC 2014 and I'm attempting to put 2 separate images side by side in the same document based on an instructional video I watched on Lynda.
    I know of one way to do this but, the Lynda's instructor method made things look so much easier and quicker to do.
    He didn't create a new canvas or make any image size adjustments.
    He basically imported 2 images, used the move tool to drag the open image and drop it in the the tab heading of the other image.
    After doing that, he ended up with two layers, the background layer and the "layer 1" layer.
    He then was able to use the move tool again to position layer 1 in the document and then use the expand all option (I think it was) so both images were visible side by side.
    He moved the layer 1 layer to the far left that it almost wasn't visible and that's why he used the expand all function.
    The problem I'm running into is, I'm not getting the "layer 1" after doing the drag and drop.
    The only layer I have is the background layer.
    The odd thing is, that was the only layer he had as well after he did the drag and drop.
    But, after he gave the tip of holding the shift key while the drag and drop was being done to center the images, it was then, the layer 1 layer appeared in his layers pallet.
    I tried holding the shift key as well and I still can't get the layer 1 to appear.
    I've watched the video a few times to see if I missed something he did and i can't see that I have.
    How do I get layer 1 to appear so I can complete the rest of the process described in the video?
    If any members here have full access to the Lynda videos, this is the one I watched:
    The instructions for this particular process is about half way through the 4 minute video.
    I've sent basically the same question to Lynda but it could take up to 3 business days for a reply and I was hoping someone here might have an answer sooner.
    Watching: 
    Combining multiple images together as layers
    From:
    Photoshop CC for Photographers: Fundamentals
    with Chris Orwig

    Trevor,
    Fleming doesn't want to extend the canvas, mind you.
    P Fleming wrote:
    He didn't create a new canvas or make any image size adjustments.
    He also doesn't want to drag layers but drag image tabs. 
    And the video tutorial ends up with two different images on top of each other, contrary to his initially desired "side by side" arrangement.
    It's all for the birds, IMO.             

  • Updating Feed URL :- Inadvertantly Updated Two Seperate Feeds to Same Feed

    There are two seperate feeds in iTunes Music Store for Immaculate Heart of Mary Podcasts.
    [1] http://itunes.apple.com/us/podcast/immaculate-heart-mary-homily/id294766875
    [2] http://itunes.apple.com/us/podcast/immaculate-heart-mary-homily/id295664714
    Originally these feeds were pointing to two different feed URLs. During the process of moving hosting solutions, both of these feeds are now pointing to the same feed:
    http://feeds.feedburner.com/ImmaculateHeartOfMaryHomily-cast
    One of these should point to the feed mentioned above, while the other one should point to the following feed:
    http://feeds.feedburner.com/ImmaculateHeartOfMaryLivingtheliturgy-themass
    Can you offer any suggestions on how I might update one of the feeds without updating the other. I have attempted to add the new-feed-url tag and using the ping service. While that worked for my local podcast feed, it did not work for the store.
    Any assistance with this would be greatly appreciated.
    Thanks

    You have painted yourself into a corner, I'm afraid. The 'itunes:new-feed-url' (which you would insert in the feed they are both using) should work perfectly well but will redirect both podcasts to the other feed, which won't get you anywhere.
    You have two options, neither of them much fun. You could get one of the podcasts removed from the Store - instructions here - and submit your new feed as an entirely new podcast. You will probably need to make a small change in the title, as a bug in the Store software may tell you that the podcast has already been submitted: and of course you will lose any subscribers or comments. Incidentally the last person to post about having tried this was told to use the 'block' tag - obviously this is no good as it will block both podcasts.
    The other option is somewhat uncertain. iTunes Support is notoriously unhelpful, often sending back form answers which often don't deal with the actual problem, or referring the questioner to the Discussions Forum (which may have sent the questioner there in the first place): however it has been known for someone to persuade Support to shift their podcast to a new URL, so it's worth trying. It's probably just a matter of luck who you get. To contact iTunes Support, go to http://www.apple.com/support/itunes/ - click on 'Other iTunes Store Features' in the list and then on 'Podcasts'.

  • Combining two seperate pagemaker files into one pagemaker file.

    We are having done two seperate pagemaking files in two different systems. We are in need to combine/join these two pagemaker publications into one pagemaker publication. How to do this?

    There's several options.
    1. If the two publications are on different PCs, then create a PDF of each and combine them in Acrobat.
    2.Use the Book utility to combine the files when you print.  They need to be on the same PC.
    3. If the two publications are on the same PC (with all the necessary fonts and images), and the files are small, i.e. no more than a few pages, then open both publications in PM.  Tile the two publications side by side.  Add the required number of new pages to the first document, and have "New page 1" opposite "Page 1" of the second publication.
    With the pointer tool selected in the second publication, click Edit - Select All.  Then quickly drag all the objects acroos to "New Page 1" in the first publication.
    Do the same for the remaining pages - hence the requirement for not having too many pages.
    Use File - Save As to save the first publication with a new filename.  All links to images will be preserved.

  • Loading an image in an applet

    I am trying to load and display an existing image to my applet and break the image up into segments to allow the pieces to be moved into their correct position. However it is only getting as far as cutting the image up but it does not complete loading the image. Below is the run() method im using to load it:
    public void run()
            int i;
            MediaTracker trackset;              // Tracker for images
            Image WholeImage;                 // The whole image
                        Image ResizedImage;
            ImageFilter filter;
         // Determine the size of the applet
         r = getSize();
            // Load up the image
            if (getParameter("SRC") == null)
              Error("Image filename not defined.");
         WholeImage = getImage(getDocumentBase(), getParameter("SRC"));
         // Scale original image if needed
            // Make the image load completely and put the image
            // into the track set.  Where it waits in paint() method.
            trackset = new MediaTracker(this);
            trackset.addImage(WholeImage, 1);
            // Mix up the puzzle
            System.out.println("Mixing puzzle.");
            PaintScreen = 2;
            repaint();
            try {
            Thread.sleep(100);
         } catch (InterruptedException e) {
            // Tell user of the wait for image loading
           //Trap trackset exceptions that track if the image
           //hasn't loaded properly and output to the user.
            PaintScreen = 0;
            repaint();
            try {
            Thread.sleep(100);
         } catch (InterruptedException e) {
            try {
               trackset.waitForID(1);
            } catch (InterruptedException e) {
               Error("Loading Interrupted!");
            // Check if image loaded up correctly
            //Where is image is held in the same directory
            //as the HTML file use getImage method to pass
            //getDocumentBase(), taking in the getParameter.
            if (WholeImage.getWidth(this) == -1)
                 PaintScreen = 3;
                 repaint();
                 WholeImage = getImage(getDocumentBase(), getParameter("SRC"));
                 trackset = new MediaTracker(this);
                 trackset.addImage(WholeImage, 1);
                 try {
                    trackset.waitForID(1);
                 } catch (InterruptedException e) {
                    Error("Loading Interrupted!");
                 if (WholeImage.getWidth(this) == -1)
                      PaintScreen = 4;
                      repaint();
                      stop();
                      return;
         // Resize picture if needed.
         int ResizeOption = integerFromString(getParameter("RESIZE"));
         if ((r.width != WholeImage.getWidth(this) ||
              r.height != WholeImage.getHeight(this)) &&
                ResizeOption != 0)
              if (ResizeOption == 2)
                ResizedImage =
                  WholeImage.getScaledInstance(r.width, r.height - TOP_MARGIN,
                                     WholeImage.SCALE_FAST);
              else if (ResizeOption == 3)
                ResizedImage =
                  WholeImage.getScaledInstance(r.width, r.height - TOP_MARGIN,
                                     WholeImage.SCALE_SMOOTH);
              else if (ResizeOption == 4)
                ResizedImage =
                  WholeImage.getScaledInstance(r.width, r.height - TOP_MARGIN,
                                     WholeImage.SCALE_AREA_AVERAGING);
              else
                ResizedImage =
                  WholeImage.getScaledInstance(r.width, r.height - TOP_MARGIN,
                                     WholeImage.SCALE_DEFAULT);
              trackset.addImage(ResizedImage, 2);
              PaintScreen = 5;
              repaint();
              try {
              Thread.sleep(100);
              } catch (InterruptedException e) {
              try {
              trackset.waitForID(2);
              } catch (InterruptedException e) {
              Error("Loading Interrupted!");
              WholeImage = ResizedImage;
            // Complete loading image.  Start background loading other things
            // Also put image into the Graphics class
            // Split up main image into smaller images
            PaintScreen = 1;
            repaint();
            try {
               Thread.sleep(100);
            } catch (InterruptedException e){}
            piecewidth = WholeImage.getWidth(this) / piecesx;
            pieceheight = WholeImage.getHeight(this) / piecesy;
            System.out.println("Image has loaded.  X=" +
                               WholeImage.getWidth(this) + " Y=" +
                               WholeImage.getHeight(this));
            imageset = new Image[totalpieces];
            for (i = 0; i < totalpieces; i++)
                 filter = new CropImageFilter(GetPieceX(i) * piecewidth,
                                              GetPieceY(i) * pieceheight,
                                              piecewidth, pieceheight);
                 imageset[i] = createImage(new
                                           FilteredImageSource(WholeImage.getSource(),
                                                               filter));
            // Set up the mouse listener
            System.out.println("Adding mouse listener.");
            addMouseListener(this);
            // Complete mixing the image parts
            System.out.println("Displaying puzzle.");
            PaintScreen = -1;
            repaint();
            while (end != null)
              try {
                 Thread.sleep(100);
              } catch (InterruptedException e){}
         }Any help to where im going wrong would be much appreciated. Thanks!

    ive seen this one many times and it dosent work for me! Shouldnt the second parameter of the getImage(...) method not include the 'http://..." part as that what getDocumentBase() is for, returning the URL of the page the applet is embedded in? I have tried using code like this and event getting a printout of the doc/code base into the console to make sure my images are in the right place (.gif images), and nothing's happening, null pointer every time!
    {code}
    Image image;
    public void init() {
    // Load image
    image = getImage(getDocumentBase(), "http://hostname/image.gif");
    public void paint(Graphics g) {
    // Draw image
    g.drawImage(image, 0, 0, this);
    {code}
    ps this code is from the site mentioned above
    Edited by: Sir_Dori on Dec 8, 2008 8:37 AM

  • Help!  Image in an applet

    Hi, I'm having some trouble displaying an image in my applet. I drew something in MS Paint, saved it as a gif, and want to draw it in my applet. I have tried using two methods to load the image:
    map = getImage(getCodeBase(),"cheese.gif");
    and
    Toolkit toolkit = getToolkit();
    map =toolkit.createImage("cheese.gif");
    System.out.println(map == null) prints false for both methods, meaning that (I assume) Java has found and knows what .gif I am requesting. I am drawing the image with
    g.drawImage(map, 25, 150, this);
    I have tried replacing "this" with "getContentPane()" as well, but that was fruitless.
    I think am importing all the right classes, like java.awt.*.
    My applet extends JApplet (I don't know this has anything to do with it). I would post the entire applet, but it is quite lengthy at the moment. Any help would be much appreciated, thanks in advance, and sorry about the long post. If anyone needs anymore information to help me, I will be glad to help.

    Try this html and code:
    <HTML>
        <HEAD>
            <TITLE></TITLE
        </HEAD>
        <BODY>
            <APPLET CODE="ImgApplet.class" width=500 height=500>
            <PARAM NAME=pic VALUE="ImgAppletPic.jpg">
            </APPLET>
        </BODY>
    </HTML>
    import java.awt.*;
    import java.applet.*;
    public class ImgApplet extends Applet {
        // var to store the pic;
        Image pic;
            // retrieving image;
            public void init() {
            pic = getImage(getCodeBase(), getParameter("pic"));
            public void paint(Graphics g) {
            g.drawImage(pic, 10, 10, this);
    }

  • After OS X update moving 1:1 images results in low resolution and a long delay to snap into high res

    After the OS X 10.8.5 update on my current generation 27' iMac moving 1:1 images results in very low resolution for those areas I am moving to with as long as a two second delay before the image snaps back into full resolution. Not only that but when it snaps back into full resolution you see a shift in alignment and a snapping into place with the nearby area that was already in full resolution. This is awful and is occuring with Lightroom 5 and 5.2. Has anyone experienced this?
    My iMacs specs are the current generation 27" iMac, i7 3.4 Ghz, 32GB RAM, and the NVIDIA GeForce GTX 680MX 2GB running OS X 10.8.5.
    I did not have this issue with OS X 10.8.3.

    I have noticed something similar on my Win7x64 system, but am not able to reliably reproduce it. It seems, for me at least, to be a combination of +Clarity and Lens Profile Correction which will always trigger an observable screen redraw when moving from segment to segment in 1:1 view mode. The variable is the delay.....most often it's a fleeting effect, but occasionally there's a more obvious delay in redrawing the image display. I suspect the more obvious delay is, in addition to the +Clarity and Lens Correction, some internal resource utilisation over a longer Lightroom session....certainly every time I've encountered it a Lightroom restart has cleared it up.
    Don't know it that helps, or gives you any pointers to reducing the impact. Because of another "issue" with Lens Corrections (when it's applied, Spot Removal work gets slower), I tend to apply it last of all when editing pictures....so that also helps avoid this 1:1 screen redraw problem.

  • Two seperate animations running at the same time

    Hi
    I would like to make a fully automated presentation, with some object moving and the like... I am trying to have two seperate animations running on the same slide. The animations are quite simple - move in, move around, move out. What I would like is that they both act seperately so they start at the same time, but otherwise begins to move at different times and exits at different times. I'm having trouble achieving this as i can only link automatic actions to the last action on the list (i.e. I can't have two trees of actions that start simultaneous)
    I hope I have succedes in complicating an otherwise straightforward question with my late-at-night english

    You'll have to be more imaginative with the way you structure the builds so you can in fact do it inside one tree. (Not a put down, just it's hard to give more exact answer because the question has few specifics).
    Remember you have +*delay options*+ for each build, so two concurrent build/move actions can actually occur at different times in the presentation. Play with the start build and delay controls and you should be apples.

  • Recording on two seperate devices

    I ran into a confusing request. What do you do when you need
    to record a program that runs simultaneously on two seperate
    devices (PCs). Has anyone ever come across this? I'm just trying to
    figure out an effective way of showing both PCs...

    If you're just trying to let the user see the difference,
    another thought is to keep the Windows theme the same on both
    workstations and show the screenshot from Computer A as the slide
    background and show the screenshot from Computer B as a rollover
    image.
    This lets the user do an A/B comparison as many times as it
    takes to get all the differences. You can even add callouts to the
    computer B image to highlight the changed items. Assuming the two
    screens are similar with the same dimensions, it can be very
    effective.

  • Image Processing using applet

    hi,
    I am doing my project in java.My project is " Online Image Processing ".
    I did some processing like gray Scale, Invert , Contrast and rotate 90 degree.
    can any one help me for
    1. I vant to rotate Image to 1 degree...
    2. How to get Blure and Sharpen image?
    3. Can i append frames inside applet?
    plz Help me ..

    I did not read the content of the links (To lazy) just found them for you.
    You say that the examples use frames:
    this should not be a problem as the required code is the same.
    Tip:
    How whould you display a image in a frame?
    How whould you display a image in a applet?
    Concentrate on the above 2 and simply change the code accordingly.
    This should be easy also try asking google.

  • How to writing an image from my applet to my apache webserver

    hi everyone,
    i have a big problem, writing an image from my applet to my apache
    webserver. i tried three way's of writing that file. every way was
    described in forums to solve this problem, but non of them worked and
    i don't know why. i'll give you the code of my writing-methods and
    describe, what happen when i test them, in order someone of you can
    give me an usefull tip, where the problem is.
    as inputparameter i give my method a new URL referring to
    http://localhost/test.jpg (this is the same directory, where my applet
    is loaded from, so i should have reading and writing permission,
    havn't i? while i'm developing, my applet runs on the same pc as my
    webserver, just in case you're wondering about localhost) and a
    selfmade BufferedImage (i already testet if it is not null and shows
    the correct things ... all ok).
    1. try:
    private void writeImageToServer(URL fileURL,BufferedImage img){
    try {
    URLConnection urlConnection = fileURL.openConnection();
    urlConnection.setDoOutput(true);
    OutputStream urlout = urlConnection.getOutputStream();
    BufferedOutputStream out = new BufferedOutputStream(urlout);
    ImageIO.write(img,"jpg",out);
    out.close(); // i also tried without this line -> same result
    // additionally a question: do i need
    out.close()?
    catch( IOException e ){
    e.printStackTrace();
    result:
    test.jpg doesn't appear in the webroot. but some very strange messages
    in the error.log of my apacheserver:
    [Tue Jun 08 11:40:22 2004] [error] [client 127.0.0.1] File does not
    exist: c:/programme/apache
    group/apache/htdocs/meta-inf/services/javax.imageio.spi.ImageOutputStreamSpi
    [Tue Jun 08 11:40:22 2004] [error] [client 127.0.0.1] File does not
    exist: c:/programme/apache
    group/apache/htdocs/meta-inf/services/javax.imageio.spi.ImageReaderSpi
    [Tue Jun 08 11:40:22 2004] [error] [client 127.0.0.1] File does not
    exist: c:/programme/apache
    group/apache/htdocs/meta-inf/services/javax.imageio.spi.ImageInputStreamSpi
    [Tue Jun 08 11:40:22 2004] [error] [client 127.0.0.1] File does not
    exist: c:/programme/apache
    group/apache/htdocs/meta-inf/services/javax.imageio.spi.ImageWriterSpi
    [Tue Jun 08 11:40:22 2004] [error] [client 127.0.0.1] File does not
    exist: c:/programme/apache
    group/apache/htdocs/meta-inf/services/javax.imageio.spi.ImageTranscoderSpi
    i cannot explain this lines to myself, because my apache should have
    nothing to do with java. all my javacode is executed on the client
    side in the browser. do this messages mean i have to add the ImageIO
    package from the sdk to my jar-applet. the jre, used by my iexplorer,
    doesn't contain this files in the meta-inf/services directory of
    rt.jar, but that's version 1.4.2_03, the same as my sdk, and the
    rt.jar contains the corresponding classfiles at javax.imageio.spi. so
    i'm realy confused by this messages.
    2. try:
    private void writeImageToServer(URL fileURL,BufferedImage img){
    try {
    URLConnection urlConnection = fileURL.openConnection();
    urlConnection.setDoOutput(true);
    OutputStream urlout = urlConnection.getOutputStream();
    BufferedOutputStream out = new BufferedOutputStream(urlout);
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
    encoder.encode(img);
    out.close(); // same comments as above
    catch( IOException e ){
    e.printStackTrace();
    result:
    nothing. no error-messages in the error.log, no exceptions in the
    java-console and no test.jpg in the webroot. i searched my whole
    harddrives for it: nothing. isn't this the way, the JPEGImageEncoder
    works?
    3. try:
    private void writeImageToServer(URL fileURL,BufferedImage img){
    try {
    File file = new File(fileURL.toString);
    file.createNewFile();
    BufferedOutputStream out = new BufferedOutputStream(new
    FileOutputStream(file));
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
    encoder.encode(img);
    out.close(); // same comments as above
    catch( Exception e ){
    e.printStackTrace();
    result:
    the SecurityManager denies this action with "access denied" while
    calling createNewFile(). well, this way was dedicated to run from an
    application, not from an applet. i'd have to sign my applet to get the
    rights to do this, or i can edit java.policy on my client, what i
    don't want, because i cannot do this on every client, the applet will
    run, when i'm finished with it. this brings me to the question: does
    anybody know's how to sign my applet and give it full access to the
    harddrive and the webserver without paying 400$ to VeriSign for a
    commercial CA? i want to do this by myself, without paying anything
    and without giving a lot of information to another company.
    i would realy appreciate, if someone could give me a hint where i am
    wrong or how to do this correct.
    thank you very much
    [email protected]

    You hold several misconceptions. The first is that an applet can write to a server without help from the server. That will never work on a real server (though it might work in testing, if the server is on the same PC as the applet). Applets cannot get a File object that points to any place on the server.
    If you write a servlet designed for accepting image uploads, the applet can communicate back to that servlet and feed it the bytes of the image. There are other technologies that can replace the servlet, of course (PHP, ASP..) but I mention that because you say you are running Apache - and that is very Java oriented.
    For more help on servlets, try the [Web Tier APIs - Java Servlet|http://forums.sun.com/forum.jspa?forumID=33] forum.

  • Loading an image into an Applet from a JAR file

    Hello everyone, hopefully a simple question for someone to help me with!
    Im trying to load some images into an applet, currently it uses the JApplet.getImage(url) method just before registering with a media tracker, which works but for the sake of efficiency I would prefer the images all to be contained in the jar file as oppossed to being loaded individually from the server.
    Say I have a class in a package eg, 'com.mydomain.myapplet.class.bin' and an images contained in the file structure 'com.mydomain.myapplet.images.img.gif' how do I load it (and waiting for it to be loaded before preceeding?
    I've seen lots of info of the web for this but much of it is very old (pre 2000) and im sure things have changed a little since then.
    Thanks for any help!

    I don't touch applets, so I can't help you there, but here's some Friday Fun: tracking image loading.
    import java.awt.*;
    import java.awt.image.*;
    import java.beans.*;
    import java.io.*;
    import java.net.*;
    import javax.imageio.*;
    import javax.imageio.event.*;
    import javax.imageio.stream.*;
    import javax.swing.*;
    public class ImageLoader extends SwingWorker<BufferedImage, Void> {
        private URL url;
        private JLabel target;
        private IIOReadProgressAdapter listener = new IIOReadProgressAdapter() {
            @Override public void imageProgress(ImageReader source, float percentageDone) {
                setProgress((int)percentageDone);
            @Override public void imageComplete(ImageReader source) {
                setProgress(100);
        public ImageLoader(URL url, JLabel target) {
            this.url = url;
            this.target = target;
        @Override protected BufferedImage doInBackground() throws IOException {
            ImageInputStream input = ImageIO.createImageInputStream(url.openStream());
            try {
                ImageReader reader = ImageIO.getImageReaders(input).next();
                reader.addIIOReadProgressListener(listener);
                reader.setInput(input);
                return reader.read(0);
            } finally {
                input.close();
        @Override protected void done() {
            try {
                target.setIcon(new ImageIcon(get()));
            } catch(Exception e) {
                JOptionPane.showMessageDialog(null, e, "Error", JOptionPane.ERROR_MESSAGE);
        //demo
        public static void main(String[] args) throws IOException {
            final URL url = new URL("http://blogs.sun.com/jag/resource/JagHeadshot.jpg");
            EventQueue.invokeLater(new Runnable(){
                public void run() {
                    launch(url);
        static void launch(URL url) {
            JLabel imageLabel = new JLabel();
            final JProgressBar progress = new JProgressBar();
            progress.setBorderPainted(true);
            progress.setStringPainted(true);
            JScrollPane scroller = new JScrollPane(imageLabel);
            scroller.setPreferredSize(new Dimension(800,600));
            JPanel content = new JPanel(new BorderLayout());
            content.add(scroller, BorderLayout.CENTER);
            content.add(progress, BorderLayout.SOUTH);
            JFrame f = new JFrame("ImageLoader");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.setContentPane(content);
            f.pack();
            f.setLocationRelativeTo(null);
            f.setVisible(true);
            ImageLoader loader = new ImageLoader(url, imageLabel);
            loader.addPropertyChangeListener( new PropertyChangeListener() {
                 public  void propertyChange(PropertyChangeEvent evt) {
                     if ("progress".equals(evt.getPropertyName())) {
                         progress.setValue((Integer)evt.getNewValue());
                         System.out.println(evt.getNewValue());
                     } else if ("state".equals(evt.getPropertyName())) {
                         if (SwingWorker.StateValue.DONE == evt.getNewValue()) {
                             progress.setIndeterminate(true);
            loader.execute();
    abstract class IIOReadProgressAdapter implements IIOReadProgressListener {
        @Override public void imageComplete(ImageReader source) {}
        @Override public void imageProgress(ImageReader source, float percentageDone) {}
        @Override public void imageStarted(ImageReader source, int imageIndex) {}
        @Override public void readAborted(ImageReader source) {}
        @Override public void sequenceComplete(ImageReader source) {}
        @Override public void sequenceStarted(ImageReader source, int minIndex) {}
        @Override public void thumbnailComplete(ImageReader source) {}
        @Override public void thumbnailProgress(ImageReader source, float percentageDone) {}
        @Override public void thumbnailStarted(ImageReader source, int imageIndex, int thumbnailIndex) {}
    }

  • Ok... So can you have two seperate itunes accounts on the same computer?

    My dad is getting an ipod for christmas... and well I don't want him on iTunes draining all of my money. Is there a way that you can have two seperate accounts on one computer?

    Yes. If you want separate iTunes accounts, the easiest way is to set up 2 users on the computer, each with their own iTunes library.
    If the two phones share the same iTunes account this is not necessary.

  • I bought my daughter an ipod. Can I have two seperate itunes libraries on one computer? If so, how do I set this up?

    I bought my duaghter an ipod. Can I have two seperate itunes libraries on one computer? If so, how do I set this up?

    I followed these instructions & have created a new library file. However, all my music now appears in the new library as well as my own. (I bought my daughter an ipod nano for christmas & want to separate itunes libraries on one computer). How can this be so difficult?

  • Can I use one apple id to manage two seperate itunes libraries on two seperate pc's?

    First time forum user, bear with me. I have two seperate PCs with two seperate ITunes loaded (both completely dependant of each other). On itunes and one pc manages my ipod, i now wnat a seperate pc and itunes to manage my iphone. Can I use the same apple id for both?

    Hello Schurly
    Yes you can, you can have up to 5 computers authorized for playback on purchases. If you have not purchases, then there is nothing to worry about there as well.
    iTunes Store: Authorize or deauthorize your Mac or PC
    http://support.apple.com/kb/ht1420
    Regards,
    -Norm G.

Maybe you are looking for