Regarding transparent gif creation

To anyone who knows more about this subject, I'm looking for some sample code.
I've been having trouble redrawing an image as a gif while introducing transparent regions.
The following method results in blackness where the transparency should be:
    [http://www.exampledepot.com/egs/java.awt.image/DrawOnImage.html]
The next method accomplishes the transparency, but the non-transparent areas suffer in quality (I am drawing a BufferedImage of an outdoor scene after the transparency is drawn - it come out grainy). I think this is because in creating a new ColorModel to establish the transparent pixels, the original colors are approximated.
    [m-10305410]
Can anyone show me how to establish a transparent gif with the original quality of the non-transparent areas preserved?
Thanks.

I think I can accomplish what you suggest by creating the bufferedImage as type TYPE_INT_ARGB.
Although it doesn't show the creation of the BufferedImage in the first link of the two above, specifying TYPE_INT_ARGB doesn't seem to make a difference.
The second link seems to provide a way around this by setting the transparency through use of a new ColorModel.
This is guesswork. If it's a false assumption that initializing a BufferedImage with TYPE_INT_ARGB provides alpha support, let me know.
By grainy, I mean pixelated.
The code I used can be found at:
     [http://forums.sun.com/thread.jspa?threadID=5333259&tstart=45]
I had posted the subject there earlier, but I think I didn't get to the point soon enough (no replies).
You can cut and paste that code and try the two methods bWITH_TRANSPARENCY=true & bWITH_TRANSPARENCY=false and see the difference in the quality of the images produced. Just change "c:\\myjpg.jpg"; to point at a JPG file on your system.

Similar Messages

  • Transparent Gif Background?

    Hello,
    I've been trying to make a gif with a transparent background, however I've been having a few problems with it.
    While the gif does start fine and the background is transparent at the beginning, after a few frames the background color would come up and then after a few frames more it'll be transparent again, then colored again.
    It's really troubling since I've been stalking every forum I could find on the subject, however my research had deemed fruitless.
    The best I could find out is that when I change its palette on the 'Publish settings' to either Web 216 or Web Snap Adaptive--the background stays transparent! However in return, the colors of the gif turn really ugly. The only palette setting I could go with that won't ruin its colors is 'Adaptive' of course, but I really want it to be transparent and it would absolutely not give me that choice. The other option for the palette choice is Custom which also makes the background transparent--however I don't know what palette to use for it since even if I chose the photo itself as a palette resource the colors still come out undesireable. I'm not really sure what the best 'palette choice' is for custom. (do you have a specific file to use for that?)
    Anyways I would love it if I could get some help figuring this out! It seems simple enough, but I really can't for the love of me figure it out.

    Normally in transparent GIF creation only one color can be used to define the transparency.  It sounds like somewhere along the line your background color is changing such that it no longer matches the transparency color.

  • Best way to edit out a white background and make a transparent gif

    I have an image I purchased but need to make it into a gif. It already has a white background but when I use the magic wand it chops little bits of the edge of the images up.
    Is there an easier way of editing the white out of this background and making a transparent gif?
    I am using Adobe Photoshop CS2
    Image is attached to take a look.
    Thanks, I appreciate any help with this.
    Nick

    Worked perfect at a tolerance of 10, didn't know what that was for before
    Thanks!
    Nick

  • Does Keynote 6.0 no longer support Transparent GIF or Quicktime Animations?

    So, I have some sample files here:
    Bees and Honey Clear Quicktime
    http://www.presentermedia.com/blog/wp-content/uploads/2013/10/beehive_bees_400_c lr_12723.mov
    Bees and Honey Clear GIF
    http://www.presentermedia.com/blog/wp-content/uploads/2013/10/beehive_bees_150_c lr_12723.gif
    Bees and Honey Green Background Quicktime
    http://www.presentermedia.com/blog/wp-content/uploads/2013/10/beehive_bees_12723 _grn.mov
    Bees and Honey Blue Background GIF
    http://www.presentermedia.com/blog/wp-content/uploads/2013/10/beehive_bees_12723 _blue.gif
    Moving on...
    At my company, we create images, animations, video backgrounds and templates for PowerPoint and Keynote etc.  Keynote '09 (iwork '09) and PowerPoint 2008 and 2011 on the Mac, all work.  Now we're hearing that the transparent backgrounds are no longer being recognized (black background instead of clear).  Is anyone able to check this for me and let me know if there is a workaround or something? I can't find any documentation on how Quicktime changed with Maverick or Keynote 6, so need to do real world testing I'm only running '09 on my Mac and won't have Keynote 6 for another 2 weeks or so.
    Please let me know, I may be able to throw in a free subscription to our website for someone who can help me with this.

    Hello all... I'm maybe a little late to the party here, but I've had the same trouble for a while with both animated Transparent gifs and quicktime movies with an alpha channel matte.
    This morning I spent half an hour tinkering with the export options from quicktime player pro on my old laptop (I used QT 7.6.6 on OSX 10.8.5) and managed to make a "transparent" quicktime movie which plays in the new version of Keynote.
    If you have access to the old version of quicktime player pro, you can open your transparent, previously playable file (.gif or .movie) and use the ProRes compressor, using the "4444" option in the list of compressors. Make sure the colours are set to "millions+" to retain the matte and you shoud be OK.
    It works a charm... you have to re-import it, simply replacing the original file in the finder seemingly doesn't work, but you can use this method to generate a working version and take 30 seconds to re-import it into the keynote.
    Yes, the files are much larger than gifs. Yes it's a lot of messing around if you're not familiar with movies. But in principle it worked for me and sorted out a whole heap of my problems.
    Just for note, I've not tried exporting it to Powerpoint as I've no need to do so, or way to test it, but I guess that is a different matter.
    Hope that makes sense!

  • How to add text to transparent gif?

    Hi, I'm using Photoshop 6.01. with Windows 7 Professional.  I have a transparent gif file, to which I want to add text, including bullets.  The stuff I want to add is now on one of my webpages, and so is the gif, but I want to combine the image and the text.  Is there a way to do this?  If so, how?
    Thanks.

    If I understand what you are after and due to the point that Marion made. It would be wise to overlay the html text onto the graphic. To do so I recommend that you do a bit of research on CSS for absolute position and placement.
    But this assumes that the text in the html fits your needs. If you require special effects applied to the text or even fonts that are not supported via html, then you are more or left forced to use either photoshop or flash.

  • How can I take away the 1x1 transparent gif on my slideshows in muse?

    How can I take away the 1x1 transparent gif on my slideshows in muse?  It's showing up as a SEO error only on the pages that include slideshows. 

    To see all the photos on the phone, including photos that have already been imported into iPhoto, deselect the "Hide Photos Already Imported" checkbox. If the camera contains photos that have already been imported into iPhoto, those photos are hidden by default.

  • White lines around transparent gifs

    I've tried without success to eliminate the thin white line
    that appears around my transparent gifs in Fireworks. Does anyone
    know how to achieve this?

    The problem is how GIFs render transparency. What might help
    is to change the "matte" color found in the Optimize panel. It's
    probably set to white. Set it to match the background color of
    wherever the GIF is going to go.
    Because GIFs can't have semi-transparency, then anti-aliased
    (smoothed) edges basically have to have a background color baked
    into those pixels, that's what the matte color it. However, if you
    use PNG32 or PNG8 with Alpha Transparency, it will remain smooth.
    The only problem is the same problem with most things on the web:
    Internet Explorer. Alpha Transparency doesn't work in Internet
    Explorer 6 or below, without using some crazy hacks you'd have to
    google for.

  • Transparent GIFs for the web

    Hope someone can help with this.
    I'm basically trying to optimize a transparent image for the
    web. I have a straight PNG vesion here, which is what I'm trying to
    do, but it's around 96k - so a bit high.
    It looks like :
    example
    one
    I tried exporting it as an 8 bit PNG, which got the file size
    down, and looks OK in Safari, but looks hopeless in IE (6) :
    example
    2
    So I tried exporting as a transparent GIF, but it only looks
    like these :
    example
    3
    example
    4
    Any tips on how I can optimize it a bit better for the web,
    and retain it's original appearance?
    Cheers.

    As I have asked several times on the DW forum, how did you
    export the PNG
    image?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Iain71" <[email protected]> wrote in
    message
    news:fan87d$n8r$[email protected]..
    > Hope someone can help with this.
    >
    > I'm basically trying to optimize a transparent image for
    the web. I have a
    > straight PNG vesion here, which is what I'm trying to
    do, but it's around
    > 96k -
    > so a bit high.
    >
    > It looks like :
    >
    >
    http://www.handprintdvd.co.uk/webdesign/carcarenew/homepagetemp.shtml
    >
    > I tried exporting it as an 8 bit PNG, which got the file
    size down, and
    > looks
    > OK in Safari, but looks hopeless in IE (6) :
    >
    >
    http://www.handprintdvd.co.uk/webdesign/carcarenew/homepage.shtml
    >
    > So I tried exporting as a transparent GIF, but it only
    looks like these :
    >
    >
    http://www.handprintdvd.co.uk/webdesign/carcarenew/homepagetemp3.shtml
    >
    >
    http://www.handprintdvd.co.uk/webdesign/carcarenew/homepagetemp4.shtml
    >
    > Any tips on how I can optimize it a bit better for the
    web, and retain
    > it's
    > original appearance?
    >
    > Cheers.
    >

  • ANuB figures out how == overlap transparent gif in a JPanel!

    I have to say I have a hate/love realtionship with this forum. Sorry if I ofend but I know it's hard sometimes to get an answer for help as it is purely voluntary. But I've asked help for this a bazillion times and help has been min to null, but I want to say I'm hoping to post something to help someone how to figure out how to Overlap a transparent image or transparent gif over another in a custom JPanel and display it when an action is called. (action called code to follow soon in another forum)
    import java.awt.*;                                                                                          //     import extension packages
    import javax.swing.*;
    * <strong>TransparentImageExample</strong> -- drawing a transparent
    * image on top of a background image.
    public class PizzaImage extends JPanel
         private Icon     icnPizza,
                             icnLoaded,
                             icnSausage,
                             icnPepp,
                             icnOnion,
                             icnGrPep,
                             icnMush,
                             icnOlive,
                             icnGarlic,
                             icnPineApp,
                             icnSpinach;
         private Color bgColor;
         public void paintComponent( Graphics g )
              super.paintComponent( g );
              bgColor = new Color( 255, 235, 160 );
              this.setBackground( bgColor );
              icnPizza = new ImageIcon( "pzaThin.gif" );
              icnLoaded = new ImageIcon( "icnLoaded.gif" );
              icnSausage = new ImageIcon( "topSausage.gif" );
              icnPepp = new ImageIcon( "topPepp.gif" );
              icnOnion = new ImageIcon( "topOnion.gif" );
              icnGrPep = new ImageIcon( "topGrPep.gif" );
              icnMush = new ImageIcon( "topMush.gif" );
              icnOlive = new ImageIcon( "topOlives.gif" );
              icnGarlic = new ImageIcon( "topGarlic.gif" );
              //icnPineApp = new ImageIcon( "topPineApp.gif" );
              //icnSpinach = new ImageIcon( "icnLoaded.gif" );
              icnPizza.paintIcon( this, g, 0, 0 );
              icnSausage.paintIcon( this, g, 0, 0 );
              icnPepp.paintIcon( this, g, 0, 0 );
              icnOnion.paintIcon( this, g, 0, 0 );
              icnGrPep.paintIcon( this, g, 0, 0 );
              icnMush.paintIcon( this, g, 0, 0 );
              icnOlive.paintIcon( this, g, 0, 0 );
              icnGarlic.paintIcon( this, g, 0, 0 );
         public void draw()
              repaint();
    so just import the above code in a class fime which extends JPanel and display the PizzaImage objVariable  = new PizzaImage() in the component of your choice.
    [\code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    You guys are right about setting the background color outside of the paint method. I was more pre-occupied with trying to overlap the images. So now I have it set. NOW I need to draw each item when it is selected with a JCheckBox and I can't think of a good way to do that. Is there a way to undraw an image? I suppose I've gone too long w/o sleep. Here's what I have.
    // this code is in another class file
    private class chkBoxHandler implements ItemListener
              public void itemStateChanged( ItemEvent e )
                   for( int i = 0; i < chkBoxName.length; i++ )
                        if( e.getSource() == toppingChk[ i ] )     
                             if( e.getStateChange() == ItemEvent.SELECTED )
                                  pzaImage.setImage( i );
                                  pzaImage.draw();
                             if( e.getStateChange() != ItemEvent.SELECTED )
                                  JOptionPane.showMessageDialog( null, "Button Unselected",     //     displays a message
                                       "About MyPizzeria", JOptionPane.PLAIN_MESSAGE );          //     code to "undraw" the image will go here
    import java.awt.*;     
    import javax.swing.*;
    public class PizzaImage extends JPanel
         int     thisImgNum = -1;
         Icon pzaThin, icnLoaded;
         public String imgName[] = {     "topSausage.gif",
                                            "topPepp.gif",
                                            "topOnion.gif",
                                            "topGrPep.gif",
                                            "topMush.gif",
                                            "topOlives.gif",
                                            "topGarlic.gif",
                                            "topPine.gif",
                                            "topSpinach.gif"
         public Icon topping[] = {     new ImageIcon ( imgName[ 0 ] ),
                                            new ImageIcon ( imgName[ 1 ] ),
                                            new ImageIcon ( imgName[ 2 ] ),
                                            new ImageIcon ( imgName[ 3 ] ),
                                            new ImageIcon ( imgName[ 4 ] ),
                                            new ImageIcon ( imgName[ 5 ] ),
                                            new ImageIcon ( imgName[ 6 ] ),
                                            new ImageIcon ( imgName[ 7 ] ),
                                            new ImageIcon ( imgName[ 8 ] )
         private Color bgColor;
         public PizzaImage()
              setBackground(new Color(255, 235, 160));                         
              pzaThin = new ImageIcon( "pzaThin.gif" );                         
              icnLoaded = new ImageIcon( "icnLoaded.gif" );                    
         public void setImage( int img )                                             
              thisImgNum = img;                                                       
         public void paintComponent( Graphics g )                              
              super.paintComponent( g );
              pzaThin.paintIcon( this, g, 0, 0 );                                   
              if( thisImgNum == 0 )
                   topping[ 0 ].paintIcon( this, g, 0, 0 );
              if( thisImgNum == 1 )
                   topping[ 1 ].paintIcon( this, g, 0, 0 );
              if( thisImgNum == 2 )
                   topping[ 2 ].paintIcon( this, g, 0, 0 );
              if( thisImgNum == 3 )
                   topping[ 3 ].paintIcon( this, g, 0, 0 );
              if( thisImgNum == 4 )
                   topping[ 4 ].paintIcon( this, g, 0, 0 );
              if( thisImgNum == 5 )
                   topping[ 5 ].paintIcon( this, g, 0, 0 );
              if( thisImgNum == 6 )
                   topping[ 6 ].paintIcon( this, g, 0, 0 );
              if( thisImgNum == 7 )
                   topping[ 7 ].paintIcon( this, g, 0, 0 );
              if( thisImgNum == 8 )
                   topping[ 8 ].paintIcon( this, g, 0, 0 );
         public void draw()
              repaint();
    }

  • Creating a transparent GIF in Photoshop CS4

    I am new to Photoshop CS4 and I'm finding it a bit of a 'challenge'.
    I would like to create a transparent GIF of my signature, so that I can put it into various documents.
    My signature is on a white background and is written using a blue ball point pen and is scanned in as a colored GIF file.
    Despite having Googled how to do that I am completely stumped.  They talk about using the lasso tool to draw around my signature (which I do) and then they say press the delete key.  Well, on my iMac NOTHING happens!
    Can anyone offer me a simple tutorial (for the Mac) that can walk me through creating a transparent GIF file of my signature?
    Thanks,
    Peter

    Load luminance or the channel with the best contrast by command-clicking the appropriate channel in the Channels Panel
    It seems hard to make it more clear …
    Command-click (hold the command-key pressed while clicking) the composite Channel’s icon (or any of the other channels’ if you should deem them preferable) in the Channels Panel.
    This should load a Selection.
    I would like to create a transparent GIF of my signature, so that I can put it into various documents.
    Where do you want to do that anyway (Photoshop, some layout-software, a browser …)?
    Because depending on that using a file-format of fairly limited features like gif could seem inadvisable.
    the problem I have with Photoshop CS4 is that when I enter the help system it goes to the web and give me help for Photoshop CS5!!!!
    You should be able to download the Help as a pdf here:
    http://kb2.adobe.com/cps/408/kb408379.html
    If psd doen’t mean anything to you you should look it up.

  • Transparent GIFs no longer supported in iWeb '08 ?

    Was happily using transparent GIFs on previous versions of iWeb--they would appear completely blacked out in the media browser and in iPhoto, but when placed in an iWeb page, they maintained their transparency and looked fine.
    Now, with iWeb'08, they are just black. Does iWeb '08 no longer support transparency?

    Troubleshooting something else with AFP server I checked the com.apple.AppleFileServer.plist preference file and - indeed - there is no longer a specifically set option for SSHTunnel.
    Just in case Apple had made it default behaviour, I did attempt an SSH connection from a Tiger machine to a Leopard Server and a warning came up that SSH is not supported on the Leopard server.
    Apple seems to be pointing us all towards VPN's in general use - which is a good thing, as they are a snap to install and configure with Leopard Server. This is quite logical since SSH tunneling requires the user to have access to a shell, and the more security conscious administrator won't even allow a login-shell for normal users.
    If you do want to use SSH tunneling, it is still possible but you do have to the usual Terminal dance i.e. ssh -L 8548:remotehost:548 username@remotehost and then connect to the remote file server via afp://localhost:8548/.
    Generally, AFP over SSH is a kludge anyway, since it relies solely on TCP and is quite laggy and prone to failure. Also, it's quite a resource hog compared to other ways of securing network traffic.

  • What is it with transparent GIFs and Black????

    I'm trying to use transparent gifs in a little game! ;o) as an introduction to graphical java!
    Problem is when I load the images using the toolkit and then setting them as say the Icon for a panel, they are surrounded by Black?! In addition when I try to display them using an BufferedImage they are also surrounded by black?!!!
    Ive been tearing my hair out trying to understand why - and have sucessfully failed :D
    Can anyone help?!
    Pleeeeeeeeeeeeease!
    Thanks

    Can't seem to get that working?!
    If I want to put that image as the icon for the whole window how would I do that?
    ImageIcon tempIcon = new ImageIcon(Toolkit.getDefaultToolkit().getImage("images/icon.gif"));
    f.setIconImage(tempIcon.getImage());where f is a JPanel.
    The above code does not work?! I just get the black surround to the gif as before!>?

  • How to import transparent gifs in after effects cc

    I just upgraded form after effects cs5 to cc and one thing i cant understand is why i cant directly import transparent gifs as i could in cs5. I heard that you have to make a png sequence from fireworks but i dont want to go through all of that. I would appreciate if someonecan tell me how to easily import transparent animated gifs into after effects cc as you could in sc5

    You can't and that is that. This stuff used Quicktime components and simply too much has changed. You need to work with image sequences exported from Photoshop or whatever other program based on your GIF.
    Mylenium

  • Creating transparent gifs - but still retaining some opacity

    Hello,
    I'm having some issues with creating transparent gifs.
    I am creating a box with a single color in it w/ the opacity of 30% but when I save it as a gif file, it makes it completely opaque.
    I would like to save it as a gif but still making it somewhat transparent.
    Is this only possible with PNG files?
    Thank you advance...
    J

    JiggyxJ wrote:
     ...I'm just gonna have to go with PNG but my dev team won't be happy since they have to figure out a way to make the PNG file work with IE6.
    Point those dunderheads in this direction. You'll look like a hero:
    http://24ways.org/2007/supersleight-transparent-png-in-ie6

  • Trouble buffering transparent gif

    I've been working on a fairly simple interface that allows multiple people to use sprites and walk around in a room conected through the internet. I've been having lots of the normal trouble with flickering but I had solved it with buffering. As soon as I started trying to use a transparent gif as the sprite the flickering returned. Here I have greatly simplified my program to basicaly just show the flickering after you hit connect so there is a lot of stuff that was used in the full version but is pointless here. If you make "sprite.gif" a normal gif there is no problem, but when its transparent there is noticeable flickering. Does anyone know why this happens?
    import javax.swing.*;
    import java.io.PrintWriter;
    import java.net.Socket;
    import java.net.URL;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.BufferedInputStream;
    import java.io.ObjectInputStream;
    public class GifDisplay extends JPanel implements ActionListener {
        JTextArea topTextArea;
        Color m_clrBg = new Color(0, 0, 100);
        static JTextArea bottomTextArea;
        JButton button1, button2;
        final static String newline = "\n";
        static JTextField namef, input_text; // Textfields
        Button display_button; // Display button
        static JLabel message, input_label, output_label; // Labels for textfields
        String out_string;
        static JButton button;
        static Image image, image1, image2, image3, image4, image5, image6;
        static JTextArea textArea, online;
        static int start, start2;
        static Color squareColor; // The color of the square.
        int squareTop, squareLeft; // Coordinates of top-left corner of square.
        boolean focussed = false; // True when this applet has input focus.
        static boolean init = false;
        static DisplayPanel canvas; // The drawing surface on which the applet draws,
        // belonging to a nested class DisplayPanel, which
        // is defined below.
        Image m_imgOffScr = null; //  Image for off-screen drawing -- "back buffer"
        Graphics m_gOffScr = null; //  Graphics drawing interface to offscr image
        public GifDisplay() {
            super(new GridBagLayout());
            GridBagLayout gridbag = (GridBagLayout) getLayout();
            GridBagConstraints c = new GridBagConstraints();
            message = new JLabel("Enter Name:");
            gridbag.setConstraints(message, c);
            add(message);
            c.weightx = 1;
            c.ipadx = 250;
            namef = new JTextField(15);
            namef.setEditable(false);
            namef.setForeground(Color.BLACK);
            gridbag.setConstraints(namef, c);
            add(namef, c);
            c.ipadx = 0;
            c.weightx = 0;
            c.ipady = 60;
            c.gridwidth = 2;
            c.gridheight = 2;
            c.gridx = 0;
            c.gridy = 1;
            c.fill = GridBagConstraints.BOTH;
            bottomTextArea = new JTextArea();
            bottomTextArea.setEditable(false);
            JScrollPane bottomScrollPane = new JScrollPane(bottomTextArea);
            gridbag.setConstraints(bottomScrollPane, c);
            add(bottomScrollPane);
            c.ipady = 80; //reset to default
            c.ipadx = 60; //make this component tall
            c.weighty = 1.0;
            c.weightx = .8;
            c.gridwidth = 0;
            c.gridheight = 3;
            c.weighty = 1;
            // c.ipady = 40; //make this component tall
            c.gridx = 3;
            c.gridy = 0;
            online = new JTextArea();
            online.setEditable(false);
            JScrollPane onlinePane = new JScrollPane(online);
            // bottomScrollPane.setPreferredSize(preferredSize);
            gridbag.setConstraints(onlinePane, c);
            add(onlinePane);
            c.weightx = 0.0;
            c.gridwidth = 4;
            c.gridx = 0;
            c.gridy = 3;
            c.weightx = 1;
            c.weighty = 1;
            c.fill = GridBagConstraints.BOTH;
            squareColor = Color.red;
            canvas = new DisplayPanel(); // Create drawing surface and
            canvas.setBackground(Color.white); // Set the background color of the canvas.
            squareTop = canvas.getSize().height - canvas.getSize().height / 10 / 2;
            squareLeft = canvas.getSize().width - canvas.getSize().height / 10 / 2;
            gridbag.setConstraints(canvas, c);
            add(canvas);
            c.fill = GridBagConstraints.NONE;
            c.ipady = 0; //reset to default
            c.weightx = 0;
            c.weighty = 0;
            c.gridwidth = 3;
            c.gridx = 0; //aligned with button 2
            c.gridy = 7; //third row
            c.gridwidth = 1;
            button1 = new JButton("Connect");
            gridbag.setConstraints(button1, c);
            add(button1);
            start = 1;
            button1.addActionListener(this);
            namef.addActionListener(this);
            URL url = this.getClass().getResource("sprite.gif");
            image3 = getToolkit().getImage(url);
            setPreferredSize(new Dimension(500, 500));
        class DisplayPanel extends JPanel {
            public void update(Graphics g) {
                paint(g);
            public void paint(Graphics g) {
                while (Abstract.paint) {}
                if (refresh.buffer1 != null) {
                    g.drawImage(Abstract.buffer, 0, 0, this); //  Just display the "back" buffer
                } else {
                    g.setColor(m_clrBg);
                    g.drawRect(0, 0, getSize().width, getSize().height);
                Abstract.paint = true;
        } // end nested class DisplayPanel
        public static void disp(String mes) {
            bottomTextArea.append(mes);
            bottomTextArea.setCaretPosition(bottomTextArea.getDocument().getLength());
            Toolkit.getDefaultToolkit().beep();
        public static void onup(User c[]) {
            online.setText("");
            for (int l = 0; l < c.length; l++) {
                if (c[l].active && c[l].name != null) {
                    online.append(c[l].name + newline);
        public static void sen(String h) {
            try {
                PrintWriter os = new PrintWriter(Abstract.soccer().
                                                 getOutputStream());
                os.print(h + "\r\n");
                os.flush();
                init = true;
            } catch (java.io.IOException c) {
        public void actionPerformed(ActionEvent e) {
            if (e.getSource().equals(button1)) {
                if (start == 0) {
                    start = 1;
                    sen(":exit:");
                    System.err.println("Exit");
                    namef.setEditable(false);
                    button1.setText("Connect");
                    message.setText("Enter Name:");
                } else {
                    start = 0;
                    new refresh().start();
                    start2 = 0;
         * Create the GUI and show it.  For thread safety,
         * this method should be invoked from the
         * event-dispatching thread.
        private static void createAndShowGUI() {
            //Make sure we have nice window decorations.
            JFrame.setDefaultLookAndFeelDecorated(true);
            //Create and set up the window.
            JFrame frame = new JFrame("GifDisplay");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Create and set up the content pane.
            JComponent newContentPane = new GifDisplay();
            newContentPane.setOpaque(true); //content panes must be opaque
            frame.setContentPane(newContentPane);
            //Display the window.
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args) {
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    class Abstract {
        static Socket s;
        static int serial;
        static String c[];
        static String name;
        static Image buffer;
        static boolean paint = false;
        static JFrame fra;
        public static Socket soccer() {
            return s;
        public static void soccer(Socket soc) {
            s = soc;
        public static void retu(String a[]) {
            c = a;
        public static void retun(String a) {
            name = a;
        public static void fram(JFrame a) {
            fra = a;
        public static void ser(int a) {
            serial = a;
    class refresh extends Thread {
        static int f[][];
        Color m_clrBg = new Color(0, 0, 100);
        static Image buffer1;
        Graphics pad;
        final static String newline = "\n";
        private User m[];
        Image image;
        public void run() {
            int place = Abstract.serial;
            while (true) {
                if (Abstract.paint) {
                    painter(place);
                    GifDisplay.canvas.repaint();
        public void painter(int place) {
            int width = GifDisplay.canvas.getSize().width; // Width of the applet.
            int height = GifDisplay.canvas.getSize().height; // Height of the applet.
            buffer1 = GifDisplay.canvas.createImage(GifDisplay.canvas.getSize().width,
                                               GifDisplay.canvas.getSize().height);
            pad = buffer1.getGraphics();
                pad.drawImage(GifDisplay.image3, 55, 55,
                              width / 25, height / 25 * 2,
                              GifDisplay.canvas);
            Abstract.buffer = buffer1;
            Abstract.paint = false;
    }

    Cross post http://forums.java.sun.com/thread.jspa?threadID=637547
    � {�                                                                                                                                                                                           

Maybe you are looking for

  • Service Order creation from CRM Web-IC hwen user click the push button.

    Hi experts,                     I need to create the service order (in IS-U) when the user will click the push button in CRM-Web-IC. I know the RFC for the same to be used in IS-U but for that I need to get order type which is mandatory importing par

  • Error Message "Device Error - Sense Code (6 28 00)"

    Trying to burn a project made up of MP4 video files (about 2 1/2 hrs in length) and when it reaches about 97%, I receive this message "Device Error - Sense Code (6 28 00) - Not ready to ready change, Medium" and then Premiere elements 9 procedes to b

  • Pagination with 10 pages - 5 either side

    Hi all, I'm trying to get some pagination to my results page. I would like the navigation links to only show 5 pages on either side of the current page. For example if I have 40 pages in total: Page 1 shows: *1* _2_ _3_ _4_ _5_ _6_ _7_ _8_ _9_ _10_ [

  • My Understanding of CRM 5.0

    Hi Guys, I have read on SAP service regarding the CRM 5.0 and this is my undesrstanding. Can you Guys please correct me if I am wrong. The 4.0 is more focussed on the Marketing  but the 5.0 is more focussed on SALES Mobile SALEs is not fully supporte

  • Install 11.5.10 on USB portable hard disk media

    can 11.5.10 be installed on a USB portable hard disk connected on a notebook/laptop computer. did any one do this? does it works with out problems? these are some of the doubts i need to clarify. any response to this will be appreciated thanks