Changing an image.

hi.
i have a JLabel with an image, like so:
JLabel label = new JLabel("", m_image1, SwingConstants.TRAILING);i want to change that image to another image with the same dimensions.
this:
label.setIcon(m_image2);doesn't work...
even if i add label.repaint() nothing changes.
how do i make it change?
thanks!

* @(#)AnimLabel.java     Tiger 2005 April 27
package com.yahoo.ron.label;
import com.yahoo.ron.NullIconException;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.util.Timer;
import java.util.TimerTask;
import java.util.Vector;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
* In case this topic isnt solved.
* This is a simple demo for me and this is what I think may solve Nittm problem.
* Nittm told me that he/she has a problem using setIcon(), so I gave (this code) him/her another approach by making a customized JLabel.
* Im sorry, I thought this will help. Im sorry.
* Im just renting a computer, the computer here doesnt have jdk installed. Installation is restricted.
* Just make some modification if problem occur. Please dont curse me, I just wanna help. -Ron.
* God bless you all. Thanks.
final public class AnimLabel extends JLabel{
     private String text;
     private Vector images;
     private int index = 0;
     public AnimLabel(String text){
          this(text, null);
     public AnimLabel(String text, Vector images){
          super(text);
          this.images = images;
          this.text = text;
          TimerTask timerTask = new TimerTask(){
               public void run(){
                    doPaint();
          new Timer().schedule(timerTask, 0, 200);
     public void addImageIcon(ImageIcon icon) throws NullIconException{
          if(icon == null)
               throw new NullIconException(new NullPointerException());
          if(images == null)
               images = new Vector();
          images.addElement(icon);
     private void doPaint(){
          if(images == null || images.isEmpty()) return;
          index = (index + 1) % images.size();
          repaint();
     public void paintComponent(Graphics g){
          super.paintComponent(g);
          if(images == null || images.isEmpty()) return;
          ImageIcon icon = (ImageIcon) images.get(index);
          int w = icon.getIconWidth();
          int h = icon.getIconHeight();
          if(w < 20 || w > 20) w = 20;
          if(h < 20 || h > 20) h = 20;
          Image image = icon.getImage().getScaledInstance(w, h, Image.SCALE_SMOOTH);
          BufferedImage bufferedImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
          bufferedImage.getGraphics().drawImage(image, 0, 0, this);
          g.drawImage(bufferedImage, 0, 0, this);
          if(text == null || text.trim().equals(""))
               g.drawString("text not set", w + 5, 0);
          else
               g.drawString(text, w + 5, 0);
* @(#)AnimLabelApplet.java          Tiger     2005 April 27
package com.yahoo.ron.test;
import com.yahoo.ron.label.AnimLabel;
import javax.swing.ImageIcon;
import javax.swing.JApplet;
* In case this topic isnt solved.
* This is a simple demo for me and this is what I think may solve Nittm problem.
* Nittm told me that he/she has a problem using setIcon(), so I gave (this code) him/her another approach by making a customized JLabel.
* Im sorry, I thought this will help. Im sorry.
* Im just renting a computer, the computer here doesnt have jdk installed. Installation is restricted.
* Just make some modification if problem occur. Please dont curse me, I just wanna help.
* God bless you all. Thanks.
public class AnimLabelApplet extends JApplet{
     public void init(){
          AnimLabel animLabel = new AnimLabel("Flip Label");
          int d = 0;
          while(d < 10)
               animLabel.addImageIcon(new ImageIcon(getParameter("icon" + ++d)));
          getContentPane().add(animLabel);
// Im sorry for the late reply, Im kinda busy with my thesis project and Im just renting a computer (for internet) for me to participate to this forum. Im sorry.
// God bless you all. Thanks.

Similar Messages

  • Problem in changing branding image.

    Hi all,
    I have a problem in changing the branding image for portal logon page.
    To my knowledge I have the change the image file under
    \usr\sap\EPD\JC0\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\portalapps\com.sap.portal.runtime.logon\layout
    But to my surprise I am not able to see gthe com.sap.portal.runtime.logon folder in the server.
    Can somebody suugest me what might be the reason.Is it any problem with the versions or something?
    Thank You,
    Regards,
    Rajesh

    It is:
    \usr\sap\EPD\JC0\j2ee\cluster\server0\apps\sap.com\com.sap.security.core.admin\servlet_jsp\logon\root\layout\
    You can do a simple search for branding-image.jpg from \usr\sap\EPD\JC0\j2ee\cluster\server0 to find the location. You can change the location or name in the config tool.
    Regards,
    Slava

  • How do I change an image border color to another color - Dreamweaver CS5?

    Good day,
    I have just learned how to add a border to an image with Dreamweaver CS5 within the Properties Inspector.
    After typing the width in pixels in the Border Text Field and pressing the Enter key, Dreamweaver created a black border.
    How do I change the image border color to another color?

    I added your suggested rule to the Style Sheet "in any order" as you explained. See the image below.
    However this did not change the image border from black to light blue. In fact, nothing changed.
    Nothing changed because the CSS that has been written into DW is incorrectly written.
    You want the following (exactly as written below)
    img {border: 4px solid #0062C8;}
    You've inadvertently wrapped the rule inside a #main_image container rendering it meaningless.
    It's easiest to go into Code View and change
    #main_image {
         img {border: 4px solid #0062C8;
    to
    img { border: 4px solid #0062C8; }
    The Property Inspector added a border exactly as I wanted it, other than the color I wanted the border to be. What is the use of this function in Property Inspector if it can add a border within Property Inspector but not let me change the COLOR of the black border that Property Inspector added, to another color?
    That's a deceptively simple, yet valid, question with a long answer.
    Back in the dark old days of web design web designers were restricted to inline HTML formatting which offered  border properties but no colors.
    CSS styling offers colors and more but has to be written differently.
    These days. it's best to avoid HTML formatting. Unfortunately border="4px" in the PI still allows it. But does not permit color.
    Does anyone else out there ever add color borders to their IMAGES (not the containing box for the image) ?
    Yes, using CSS.

  • How can I change an image to look like a watercolor painting?

    I'm using FW CS6 and need to change an image (.bmp, .jpeg, .jpg or .fw) to look like a watercolor painting.  All help is appreciated.
    -Jack Ripley

    Maybe you had installed an action into your previous version of photoshop elements?
    Anyway here's an action that will work in pse 11, although the look is a little different.
    http://photoshop-action.no/specialfx.htm
    Also, some from panos fx
    http://www.panosfx.com/commercial-free-photoshop-actions/film-machine

  • Is there a way to change the image numbers in a file in Aperture?

    Is there a way to change the image numbers in a file in Aperture? We shoot with two photographers and so the img numbers are not in order but I would like to have the photos in chronological order on the disc when I give it to them. Does anyone know how to do this? I have them all in order ready to go in Aperture but when I move them to the disc to be burned they default back to the img number order. Thanks for your help!

    What do you mean by "image number"? The file names like "IMG_7822.CR2" or "IMG_7822.jpg"?
    You can create custom names with appended numbers, when you export your image files to be saved on a disk.
    Sort your images by date in the browser, select them, then use the command "File > Export > Version" to write the files to the disk. Set the name format to "Custem Name with Index" or "Custom Name with Counter" to create numbered names in your current sort order.
    Regards
    Léonie

  • How do I change the image resolution of a photo?

    Hi..,
         I am the beginner in Photoshop.
         I want to change one image resolution from 72 dpi to 300 dpi.
         So, I search and got one pdf for change the resolution of the image. In that they mention, take the "Printscreen" of the image and paste in the photoshop and change the mode(Index - flatten) and change resolution via the "Image -> image size -> Resolution".
         Like that i did, it changed correctly.
         After that I Open one already saved image file in Photoshop and do that same steps but the resolution was not changed.
    So, now how to change that saved image resolution to 300 dpi...??
    Regards.,
    VISWA

    Viswa,
    To find the current resolution of your image, follow these steps:
    With your image open in Photoshop, Image > Image Size (Like you've already done earlier).
    Check the resolution as shown above. If it doesn't show 300, enter 300, hit OK and 'Save' your image.
    Open the file and check again. If it still shows 72, post back with more details of the type of file you're trying to open in Photoshop and if possible, a screenshot so we can help.
    -ST

  • HT3669 My Epson Perfection 1200 scanner functions as a flatbed scanner but when I try to scan transparencies the control panels change in  Image Capture but the scanner bar will not complete the overview scan  & cannot travel beyond the first 2/3 centimet

    Epson Perfection 1200 scanner continues to function as a flatbed scanner but when I try to scan transparencies/film negs the control panels change in  Image Capture but the scanner bar will not complete the overview scan  & cannot travel beyond the first 2/3 centimeters. All the communications seem to recognise the scanner and the mode for the intended scan but the necessary overview scan is not completed, nothing comes up on the Image Capture scan window. If I unplug the film adaptor I can get a document scan. When I plug in the adaptor again the Image Capture details change which allows me to select the type of scan required but when the scanner attempts an overview scan it is unable to complete it.
    I have had the scanner from new (12 Years) and have previously scanned slides and film with the adaptor but maybe this was before I upgraded my computer (imac 27").
    Do I have to buy a new scanner?  It seems so close to working correctly. 
    I have downloaded the Epson recommended driver (5.4) and have Epson Perfection 1200 6.6 Universal showing in the Applications List.
    Any thoughts or observations would be much appreciated before I go out and spend money an new hardware.
    Thanks

    I have same issue - have you solved this yet?

  • Question about changing ID3 images

    Hey everyone. I recently changed my podcast artwork. I use Powerpress, so changing the MAIN artwork was quite easy. So for this question, I am referencing only the individual art that is displayed with each individual episode.
    I know that for iTunes to recognize a change in episode artwork, that it cannot have the same name as the previous. The new artwork embedded does have a new name but is it the artwork that needs a different name, or the entire mp3 that needs a new name? Once artwork becomes embedded as ID3 I'm not sure if it loses its name altogether. So I need to know specifically what needs a new name for iTunes to update my episode art? Pic name or mp3 name?
    Thanks for your time!

    Thanks for the response Roger.
    So just to be clear, I have changed the images embedded in my MP3s. I then re-uploaded them to Libsyn using the replace function. So I now have MP3s with the exact same name as before, but with a new image embedded. Are you saying iTunes will see the image change in each episode even though the name of my MP3 is exactly the same?
    So far, iTunes has immediately updated my main podcast image but all my individual episodes still have the old image.
    You can probably see what I'm talking about by searching iTunes for Netflix Junkies. You'll see that 'episodes' has different artwork than 'podcasts' in the search results. Do I just need to wait it out? Or rename my mp3s?
    Keep in mind, there is another podcast with the same name no artwork. This is not my podcast but someone else's.
    Thanks again!

  • How to change the images dynamically in a table.

    Hai,
                     How to change the images dynamically in a table based on the condition in webdynpro abap.
    Edited by: Ravi.Seela on Oct 13, 2011 2:17 PM

    This has been much discussed earlier. Do search posts.
    For your scenario i would do the following.
    inside your node which is binded to the table, i create a new node image with cardinality 1 ..1 and a attribute called path of type string.
    create a  supply function for the node image .
    Supply method now has a Element (Parent element ) and node.
    Based on your record in element, set the right image source to path attribute and bind the node.
    This will make sure that the framework calls the image supply function for every row in a table.

  • How to change the image of a selected File/Directory in JFileChooser while

    Hi all,
    I am trying to customize JFileChooser. Basically, I want to display a checked Icon for a selected directory(s) in JFileChooser
    I know that fileView class returns icon for directory/files, but I am not sure how to change their images on selection.
    your help is appreciated.
    Ramesh

    could you please anyone help me with this. I search all the web but I was not successful to find anything that would help me to create a custom renderer for JList component inside JFileChooser..
    if you can give me some reference websites that would be great.
    Ramesh

  • How do I change an image in muse composition news feature widget?

    how do I change an image in muse compostion news feature widget?

    There are multiple ways to do that.
    You can either use File > Place to place an image on the page somewhere and then drag the image inside the widget target container.
    Or you can go to Assets panel, go to the image you want to change, right (or command) click on it and choose Relink. Then navigate to the new image and select it to replace the current image.
    Hope this helps.
    Cheers,
    Vikas

  • How to change the image in SAP network graphics

    In my development with SAP network graphics, I found it difficult to change the image displayed in SAP network graphics. and i define the image path in IMG, it doesn't work. Is there any one who can tell me how to diplay a image in SAP network graphics. In my program the class cl_gui_netchart is used. 
    Thanks a lot!

    hi,
    JFrame frame;
    frame.setVisible(true);
    frame.setIconImage(new ImageIcon("icons/img007.gif").getImage());
    frame.setSize(800,600);
    i think the thing u r searching is :
    frame.setIconImage(new ImageIcon("icons/img007.gif").getImage());
    ~~~radha

  • How to change background images in s:application

    hello!
    i want to make a webside by flex4 as  this web http://www.templatemonster.com/flash-cms-templates/29930.html
    But i don't know how to make change background images by click and make sound when load page.
    Can u help me ,please. sorry i write E not well.
    Thanks so much
    BUI THI PHUONG THANH- FROM VIETNAM

    Hi,
    please create a sink for your application inside that put your image.And apply that skin to your application on any click.
    Below is the code.
    Main Application
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/halo" xmlns:mx1="library://ns.adobe.com/flex/mx">
        <fx:Script>
            <![CDATA[
                protected function btn_click(evt:MouseEvent):void {
                    this.setStyle("skinClass", MySkinClass);
            ]]>
        </fx:Script>
        <s:Button label="Change BackGroundImage" click="btn_click(event);"/>
    </s:Application>
    MySkinClass
    <?xml version="1.0" encoding="utf-8"?>
    <s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009"
            xmlns:s="library://ns.adobe.com/flex/spark"
            xmlns:mx="library://ns.adobe.com/flex/mx">
        <!-- host component -->
        <fx:Metadata>
            [HostComponent("spark.components.supportClasses.SkinnableComponent")]
        </fx:Metadata>
        <s:states>
            <s:State name="normal" />
            <s:State name="disabled" />
        </s:states>
        <s:BitmapImage source="@Embed('image1.jpg')"  smooth="true" left="0" right="0"  top="0" bottom="0"  />
    </s:Skin>
    with Regards,
    Shardul Singh Bartwal

  • Is it possible to have a combo box change an image on a form?  How do you do it?

    I would like to have an area in one of my PDF forms where a combo box with 8 items changes an image near the combo box.  8 items 8 images.  if you select item 3 in the list then image 3 is displayed in the image area or field. 
    Is this possible?  Might someone guide me as to what steps are necessary.  I can make this happen with web, asp, c++ etc.  I just don't know how to do it in adobe if it's possible.
    example below.
    Any help or guidence is appreciated.

    Here's a sample that demonstrates what you want: https://acrobat.com/#d=It35dD4zaX5QM--Pv36F-Q
    The buttons on the right hand side would normally be hidden and you can use anything you want for their icon, even though in this case it's just text. You'll have to study the JavaScript to see how it works. There are two functions in a document-level JavaScript, one of which is called from the combo box's Keystroke event. Also, note the export values of the items in the list and how the script uses them.

  • How to change the image of the favourtie portlet

    Can anyone tell me how can I change the image of the favourite
    portlet ? I found that I can only change the title text but not
    the image. Any clue ?
    Thanks.
    -Maggie

    This is a hard coded image in the 3.0.x releases of Portal.
    If you want to change it, the only way you can do it today is to
    replace the ml_us.gif file which you will find in
    $ORACLE_HOME/portal30/images
    This is the image for the US language, there will be one for
    each language installed. e.g. ml_f.gif for French.
    If you replace that gif file with an image of your own using the
    same file name, then yours will be rendered rather than the
    default.
    Regards
    Jason

  • How to change an image size from MB to KB

    Okay I am at a loss how to change an image from 6.8MB to 290KB or at least in the KB's so we can keep from getting the file is too large message from where we want it to go to. I am at a loss when I move the inches smaller the size is still too small. Daughter is trying to move a picture to a site called my space and she keeps getting a message that the file is too large...

    Susan,
    Please see my posting to
    http://www.adobeforums.com/cgi-bin/webx/.3bc17071/4
    Mark

Maybe you are looking for

  • Cannot start Oracle 8.1.5 on Windows XP Pro

    Hi all, I am facing a hell lot of problem in starting an Oracle 815 ( Enterprise edition ) database installed on WindowsXP Pro. First problem is that , I am a Unix person and very less familier with Windows servers . I have successfully ( appearently

  • *** How to resume movie rental download?

    I started to download a movie and then had to quit iTunes and restart my Mac. When I opened iTunes it wasn't there so I searched for it and the message said "you've already rented this, do you want to rent it again?". I was only about 75mb into a 1.0

  • M2T files in FCE3.5?

    How can I handle M2T files in FCE 3.5? Will version 4 recognize them?....Is there an easy way to convert them to the Qucktime intermediate codec?....I understand that in this form they take up way more space? thanks Len

  • Lost my lists after upgrading itunes10.6

    HI there! I'm on my way to get insane! I've lost all my files after the last update of itunes.The message is that my itunes library is not compatible with the new version of itunes 10.6. Since I've made this upgrade,I can't recover my ancient files!

  • Plugin container has stopped working

    My firefox is not working - help. it doesn't even type ... sluggish and keeps crashing and a stop plugin notice keeps popping up hundreds of times. I need to work and am unsure how to proceed.