Flickering-Image -----Please Help

Pls help meI have one hand image. I am drawing polygon above each finger.
Whenever the user clicks on particular finger, we are changing the color of that polygon.
We are changing the colors of the fingers(polygons) based on the database value when some functionalty is invoked. We are updating this color in PaintComponent of JPanel. The colors are flickering some time.
Please help.
Thanks in Advance.
code -------------
class ImagePanel extends JPanel {
Image img1,img2;
URL imageUrl1,imageUrl2;
     int x,y;
     public ImagePanel() {
create 10 polygons for 10 fingers
setLayout(null);
     this.addMouseListener(new panelMouseListener(this));
//this method creates the status panel
     void fillPoly() {
     //set the color of the fingers to green (when template is available).
          Graphics g=getGraphics();
          Graphics2D gg = (Graphics2D)g;
//fetching the records from database and depending on records changing the color to green yellow and selected finger to red
               if(fingerId==1)     {
                    gg.setColor(Color.red);
                    gg.fillPolygon(p[0]);
          } else if(fingerId==2) {
               gg.setColor(Color.red);
               gg.fillPolygon(p[1]);
public void paintComponent(Graphics gg) {
Graphics2D g = (Graphics2D)gg;
super.paintComponent(g); //paint background
int x1,y1;
     fillPoly();
//left hand
if(p[0].contains(x,y)) {
     //g.drawImage(img1, 0, 0, this);
     //g.drawImage(img2,110, 0, this);
     fingerId=1;
          msg="left pinkie finger";
          flag=true;
          showFingerImages(fingerId,flag);
          fillPoly();
     } else if(p[1].contains(x,y)) {
          //g.drawImage(img1, 0, 0, this);
          //g.drawImage(img2, 110, 0, this);
          fingerId=2;
     msg="left ring finger";
     flag=true;
     showFingerImages(fingerId,flag);
     }else {
          //g.drawImage(img1, 0, 0, this);
               //g.drawImage(img2, 110, 0, this);
               fingerId=0;
               msg="Please Select The Finger";
     g.drawImage(img1, 0, 0, this);
     g.drawImage(img2,110, 0, this);
class panelMouseListener extends MouseAdapter {
          ImagePanel ip;
          panelMouseListener(ImagePanel ip)
          { this.ip=ip;
     public void mousePressed(MouseEvent me) {
     x=me.getX();
     y=me.getY();
     //fillPoly();
     ip.repaint();

I'm not sure you model is the best but, nevermind, pass the graphics as argument of the method fillPoly :
class ImagePanel extends JPanel {
     Image img1,img2;
     URL imageUrl1,imageUrl2;
     int x,y;
     public ImagePanel() {
          setLayout(null);
          addMouseListener(new PanelMouseListener());
     //this method creates the status panel
     void fillPoly(Graphics2D g) {
          //set the color of the fingers to green (when template is available).
          //fetching the records from database and depending on records changing the color to green yellow and selected finger to red
          if(fingerId==1) {
               g.setColor(Color.red);
               g.fillPolygon(p[0]);
          else if(fingerId==2) {
               g.setColor(Color.red);
               g.fillPolygon(p[1]);
     public void paintComponent(Graphics gg) {
          Graphics2D g = (Graphics2D)gg;
          super.paintComponent(g); //paint background
          int x1,y1;
          fillPoly(g);
          //left hand
          if(p[0].contains(x,y)) {
               //g.drawImage(img1, 0, 0, this);
               //g.drawImage(img2,110, 0, this);
               fingerId=1;
               msg="left pinkie finger";
               flag=true;
               showFingerImages(fingerId,flag);
               fillPoly(g);
          else {
               if(p[1].contains(x,y)) {
                    //g.drawImage(img1, 0, 0, this);
                    //g.drawImage(img2, 110, 0, this);
                    fingerId=2;
                    msg="left ring finger";
                    flag=true;
                    showFingerImages(fingerId,flag);
               else {
                    //g.drawImage(img1, 0, 0, this);
                    //g.drawImage(img2, 110, 0, this);
                    fingerId=0;
                    msg="Please Select The Finger";
               g.drawImage(img1, 0, 0, this);
               g.drawImage(img2,110, 0, this);
     final class PanelMouseListener extends MouseAdapter {
          public void mousePressed(MouseEvent me) {
               x=me.getX();
               y=me.getY();
               repaint();
}I hope this helps,
Denis

Similar Messages

  • How to Load External Images - Please Help!

    I have created a simple portfolio site. The buttons I created
    trigger separate frames. Could I not create a MC (Movie Clip) on
    each frame where the images now reside and then when the button is
    clicked (On "Click' Goto frame 1) for e.g. then the image would be
    loaded from an external folder named "Images" in my website?
    I am stumped as to how to set this up. Could someone please
    help me?
    Thanks

    Yes, you can do that. Which version of Flash and which
    version of Actionscript are you using?

  • Lightroom 4 contact sheet print crashes with over 12 images - Please help.

    Lightroom 4 consistently crashes every time I attempt to print a contact sheet containing over 12 images. Any less and the task is completed without error, any more and it inevitably crashes. Any thoughts?
    My workaround has been to export the images and create large contact sheets in Photoshop CS6, but this takes twice as long.
    This is a daily task and is significantly disrupting my workflow. Please help.
    Regards,
    Eliot

    So, I had this problem tonight after experiencing no problems with Lightroom 4 previously. I noticed that in the print dialog box, where you can select to print "all" the pages or a page range, the page range radial was highlighted and the defined page range was "7" to "7". I was only printing one image so I changed the print range to "1" to "1". And it did the trick. Crazy, eh?

  • Converting awt to JAI image - please help!

    My application needs to be able to create a JAI image and apply dither to it.
    I got this working by using the fileload operator in JAI to load the image and convert it to a planar image but when I try to use the awtImage operator to convert the images to planar images it doesn't work.
    I really don't understand why this is. The two methods are pratically identical.
    This is the method that works and the error diffusion method
    public void setDitherOp(String op, String picName,KernelJAI typeDither)
                          //operation name, parameter block
        srcImg = JAI.create("fileload", "Pics/"+picName);
        dataType = srcImg.getSampleModel().getDataType();
                  //contains parameters to be used in dither operation
        pb = new ParameterBlock();
        pb.addSource(srcImg);
        layout = new ImageLayout();
        if(op=="ordered")
          orderedDither();
        else if(op=="error")
          errorDiffDither(typeDither);
    public void errorDiffDither(KernelJAI typeDither)
          if(srcImg.getNumBands()==1)   //source image has one color band
            LookupTableJAI lut =new LookupTableJAI(new byte[] {(byte)0x00, (byte)0xff});
            pb.add(lut);
            pb.add(typeDither);
            byte[] map = new byte[] {(byte)0x00, (byte)0xff};
            ColorModel cm = new IndexColorModel(1, 2, map, map, map);
            layout.setColorModel(cm);
          else if(srcImg.getNumBands()==3)  //source image has three color bands
            pb.add(ColorCube.BYTE_496);  //add color cube to parameter block
            pb.add(typeDither);          //add error filter kernel
            System.out.println("error diffusion num bands is: "+srcImg.getNumBands());
          RenderingHints rhints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout);
          ditheredImage = JAI.create("errordiffusion", pb, rhints);
          if(ditheredImage==null)System.out.println("Dithered image is NULL");
    This is the one that doesn't!
    public void setDitherOp(String op, Image frameImage,KernelJAI typeDither)
        srcImg = JAI.create("AWTImage", frameImage);
        dataType = srcImg.getSampleModel().getDataType();
                  //contains parameters to be used in dither operation
        pb = new ParameterBlock();
        pb.addSource(srcImg);
        if(srcImg==null)System.out.println("src image null in set dither op");
        /*if(srcImg!=null)
            ditheredImage = JAI.create("Invert", pb);
        layout = new ImageLayout();
        if(op=="ordered")
          orderedDither();
        else if(op=="error")
          errorDiffDither(typeDither);
    public PlanarImage getDitheredImage()
        return ditheredImage;
      }The other really odd thing in the method that uses the awtImage operator is this:
    if the code to invert the colours is executed it works fine. This must mean that it is creating the planar image from the awt image? I really don't see what the problem could be in that case because it uses the same error diffusion method after that.
    Please help me with this - its part of a project thats due up in a few days and I really need to get this part working as soon as possible.
    CurtinR

    Hi morgair,
    Thank you so much for answering!!
    You're right - the FileLoad and awtImage operators return different types of objects.
    FileLoad returns a RenderedImage
    JAI.create("fileload", "Pics/"+picName);awtImage returns a PlanarImage. The sample model and color model are set according to the AWT image data.
    srcImg = (PlanarImage)JAI.create("AWTImage", pbAwtOp);Also the error diffusion operation takes a renderedImage as a parameter. It says in the programming guide that the source image and the color map must have the same data type and number of bands. (That would explain why the method using fileLoad worked!)
    How do I change the Planar image to a rendered imaage or specify the sample model and colour model of srcImg. I've been trying to do this but am going round in circles - there are descrepancies between the programmers guide and the API and I'm lost..
    Any suggestions really really appreciated..

  • I need to clean up the edges of an image, please help!!

    I stained a t-shirt and so to make one that was the same I scanned the image on it in order to later print it on a new t-shirt. I opened the scanned image on photoshop and removed the background, then I used the quick selection tool to select the colors (only has 2 colors) and to recolor it as the colors looked dull. The problem is, the quick selection tool didn't make a 'clean/smooth' selection so the edges are VERY bad and I don't know how to fix this! Please help!!
    I took a screenshot of the image I'm working on (so that you can have a better idea) and also a close up on the edges (it's like this in all of the image)

    It sounds like you want a vector image.
    One word:  Illustrator.  That's Adobe Illustrator.

  • Podcast not showing up, neither is image Please Help!

    Hello,
    I'm sorry to start another thread when there are so many already with these problems but anything you could do to help me would be great.I have a music podcast called Rock Block
    http://rockblock.wordpress.com/
    http://feeds.feedburner.com/RockBlockPodcast
    I submitted my podcast to iTunes and it got put in the store. I am finally able to search for my podcast and get it to come up but whenever I try any kind of link i get a message saying "The item you have requested is not available in the US store"
    This is the link they gave me in the e-mail,
    http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?
    id=260388815
    I have also tried this: http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=http://feeds.fe edburner.com/RockBlockPodcast
    This: http://www.itunes.com/podcast?id=http://www.feeds.feedburner.com/RockBlockPodcas t
    and even this : itpc://feeds.feedburner.com/RockBlockPodcast
    But nothing works!
    It's been almost a week now and my image is also not showing up in the store either.
    Please help! Any suggestions would be greatly appreciated!
    Thanks

    Brian
    1 22fps sounds odd, perhaps a typo
    2 anything over 24 fps is not officially supported at that resolution
    3 is your source movie PAL/NTSC/24fps (29.97/25/24 fps) ? It's best not to convert as it can introduce stuttering between different frame rates
    4 Even if other parameters are ok, I'm not clear of the bitrate here which should be no more than 5000kbps for h264
    5 There was something in the iMovie 08 forum a while back when everyone was annoyed at the dumbing down when videos were looking soft and it was something to do with a deinterlacing flag not being set correctly on exports so only 1 field in a frame was showing making video look soft
    6 You are best setting all parameters for output manually as you are largely doing. Winston often recommends using 960x540 at whatever frame rate is needed for HD output as he feels there is little difference in quality
    7 Try converting short 20-30 sec clips only until you hit on a formula that works
    8 Don't give up - you'll get there, frustrating as it seems
    AC

  • Rating is being applied to EVERYTHING, not just the active image- please help.

    Seemingly out of nowhere a particular feature in LR stopped behaving the way it normally does for me.
    When I am in the Survey view (in the Library mode) and I have a number of images selected because I am trying to make my selections, it suddenly started applying my star rating to the entire set of say 10 images I have selected, and not just the one that is active. This is very strange- I have never seen it behave like this before. I can't remember hitting anything or changing any settings, but it just seemed to have started out of nowhere.
    It appears that if I go in and "manually" click on the star scale that appears below each of the images when you mouse over it, THEN it will apply the star rating to just that one image, but I can no longer just hit the "5" key and have just that one image that's active get the 5 star rating. It's doing it to everything.
    I've tried just restarting LR but that didn't change anything. Please please help, as this is really messing up my workflow.
    Thank you,
    Robyn
    I did visit the page below to confirm that it should indeed not be behaving in this manner:
    http://help.adobe.com/en_US/lightroom/using/WSEEE8FD0F-DFD8-47d0-A6FE-DD726E5F2E1A.html#WS 11A1E98C-3D8D-47b5-8335-4B9D8C3A5D36

    Rick,
    Thank you so much for your time and support!! Unfortunately I don't see that as an option . I'm including a screen shot of what I do see. Anything else you have to offer would be very much appreciated!
    thanks again!

  • Bridge exe. Bad Image, Please help!

    My bridge program will not open. It had been working in the past, but now I get the message "Application or DLL:\Program FilesAdobe\Adobe Bridge CS4\libaray8n28.dll is not valid windows image.  Please check against your install diskette."  Do I need to uninstall and reinstall CS4? all the disks? what do I need to do? Any help is very much appreciated.  Thank you, Jan

    This is an old CS2 Tech note but at least it mentions libagli18n28.dll.
    http://kb2.adobe.com/cps/328/328349.html
    This may also help: http://pcsupport.about.com/od/findbyerrormessage/a/libagli18n28-dll-not-found-missing-erro r.htm
    Google is your friend!

  • Hp pro 8500 keeps asking for maganta ink when it's already a new one, then loose image, please help

    HP PRO8500
    KEEPS ASKING FOR MAGANTA INK, THEN LOOSE IMAGE, I ALREADY REPLACED INK TWICE BUT ISSUE STILL PERSIST.
    PLEASE HELP

    Ok, finally got it fixed !
    Here's what was causing the issue, and what I did to fix it :
    I had free content in my iTunes download queue that I got from the "iTunes 12 days of Christmas" promotion, but the problem was that some of the items (two HD episodes) were too large to fit in my harddrive (I'm running low on free hd space) - so each time I was running iTunes I had to cancel the downloading of those items. On my iPhone, I was able to cancel the downloading once for all, but iTunes somehow wanted to try downloading them even if I deleted them. This was quite frustrating so I sent a mail to the support using the Express Lane feature on the support website, asking for thos items to be removed from my iTunes account - and tadaaaa ! Once a nice guy from Apple deleted them, my iPhone stopped asking for that stupid password !

  • Problem with remote rollover of images, please help.

    Hello,
    I got some great help yeserday on how to set up remote rollovers for a image gallery. It all works great except for when you have the curser in between the thumbnail images at bottom, the 1st image that I placed in large photo spot shows up. Any thoughts on how to fix this? Here is the page so you can look at the code. http://www.test.detarconstruction.com/homes/howard/howard.html
    Thank you so very much in advance for all your help
    Amy Sue

    You have added a "Mouse Exit" action to each of the thumbnails which always replaces the big photo with the startup image 'outside.jpg' each time you leave a thumbnail.
    (In source view you can see:
      onmouseout="changeImages('big_photo','outside.jpg');return true"
    for each of the thumbnails).
    If you simply remove all "Mouse Exit" actions the big image that belongs to the last touched thumbnail remains visible even if you leave the thumbnail and until you touch another one.
    This may be the effect you were searching for.

  • Scanner only scans partial image, please help!

    scanner not working right (HP all in one printer), when I scan from the HP device I get partial images saved into "scanner output", when I scan from the computer I get a full image with a decreased viewing field that I need to resize. Now, scanning from the computer it opens a window to save in "scanner output" which I do, the device scans, I see the image, but when I clear that box there are zero saved projects in "scanner output". I am so frustrated. I even lock the 8.5"x11" in the resize field but images/viewing fields are still partial. HELP! Any advice would be greatly appreciated.

    Hi
    Which HP AIO scanner do you have? I have the C4280. When using the Device Manager I choose>scan picture>scan to:PDF File (which I use most often)>accept>save as XX.>save to desktop.
    Try saving to Desktop so you're not searching all the time (been there, done that).
    Let me know how it goes.
    M.

  • I can't position this image - please help!

    http://aaronpenton.net/
    I want the "aaronpenton.net" (which is a background image within a div now) to be a link - so I attempted to add another div and place the image that will link to home in that div. However I can't get it to sit right.
    Here's the code I tried:
    @charset "UTF-8";
    /* CSS Document */
    #container {
        width: 755px;
        padding-left: 0px;
        padding-right: 0px;
        overflow: visible;
        height: 900px;
        float: none;
        margin-top: 0;
        margin-right: auto;
        margin-bottom: 0;
        margin-left: auto;
    #banner {
        background-image: url(images/banner.jpg);
        width: 717px;
        height: 38px;
        padding-left: 380px;
        padding-top: 22px;
        background-repeat: no-repeat;
        z-index: 1;
        float: none;
    #home {
        height: 60px;
        width: 300px;
        background-repeat: no-repeat;
        clear: none;
        margin: 0;
        float: left;
        padding: 0px;
    #design {
        height: 38px;
        width: 375px;
    #tunes {
        height: 38px;
        width: 375px;
        padding-left: 500px;
    #hand {
        background-image: url(images/hand1.jpg);
        height: 900px;
        width: 755px;
        background-repeat: no-repeat;
    #table {
        height: 800px;
        width: 639px;
        padding-left: 125px;
        padding-top: 30px;
    #player {
        height: 400px;
        width: 400px;
    #copy {
        padding: 0px;
    #flash {
    the div id = "home" is the one I want to float over top of the top left hand corner. Can someone help? Is the div in the wrong place? Should I not "float=left" the "home" div? As it sits with this code, everything gets pushed and moved around.
    What am I missing?
    Thank you

    Here is what I am seeing:
    <body onload="MM_preloadImages('images/design2.jpg','images/tunes2.jpg','images/bio2.jpg','images/contact2.jpg')">
    <div id="container">
      <div id="banner">
        <div id="design"><a href="http://aaronpenton.net/design.html"><img src="images/design1.jpg" alt="design" width="66" height="38" border="0" id="Image1" onmouseover="MM_swapImage('Image1','','images/design2.jpg',1)" onmouseout="MM_swapImgRestore();MM_swapImgRestore()" /></a><img src="images/designchunk.jpg" alt="bg" width="34" height="38" /><a href="http://aaronpenton.net/tunes.html"><img src="images/tunes1.jpg" alt="tunes" width="56" height="38" border="0" id="Image2" onmouseover="MM_swapImage('Image2','','images/tunes2.jpg',1)" onmouseout="MM_swapImgRestore();MM_swapImgRestore()" /></a><img src="images/tuneschunk.jpg" alt="bg" width="33" height="38" /><a href="http://aaronpenton.net/bio.html"><img src="images/bio1.jpg" alt="bio" width="39" height="38" border="0" id="Image3" onmouseover="MM_swapImage('Image3','','images/bio2.jpg',1)" onmouseout="MM_swapImgRestore()" /></a><img src="images/biochunk.jpg" alt="bg" width="31" height="38" /><a href="http://aaronpenton.net/contact.html"><img src="images/contact1.jpg" alt="contact" width="75" height="38" border="0" id="Image4" onmouseover="MM_swapImage('Image4','','images/contact2.jpg',1)" onmouseout="MM_swapImgRestore()" /></a><img src="images/contactchunk.jpg" alt="bg" width="41" height="38" /></div>
      </div>
      <div id="hand"></div>
    </div>
    </body>
    Can you find an id="home" in there?
    E. Michael Brandt
    www.divahtml.com
    www.divahtml.com/products/scripts_dreamweaver_extensions.php
    Standards-compliant scripts and Dreamweaver Extensions
    www.valleywebdesigns.com/vwd_Vdw.asp
    JustSo PictureWindow
    JustSo PhotoAlbum, et alia

  • Problems opening images - please help!

    I just transferred 350 photos from my camera to my Mac, and the last 179 items I cannot open.
    I receive the error message 'Item "Namehere.JPG" is used by Mac OS X and cannot be opened.' These images are also listed as having 0Kb on the disk.
    I have found this problem elsewhere on the discussion boards, but it has yet to be solved - does anyone have any ideas?!
    These images are very important to me, as they are from a recent trip and my cousin's wedding
    Thanks.

    I have actually been looking on google for a while trying to figure out how to perminately kill programs when they open, and take them off. it would be a huge help if anyone knows how.

  • FW CS3 problem with Vector Images PLEASE HELP

    Hello,
    My name is Logan and I work for a company called Sutherland
    Design Agency. I am creating a website and i created some vector
    images in illustrator for the logo because i wanted source files to
    be imported into fireworks. When I imported the ai file it seemed
    to be rasterized. Is this normal?
    I would like my images to stay as vectors in fireworks so i
    decided to test this a couple times. When i create a vector i save
    it and import it into fireworks. It's a raster. Then i export it as
    an illustrator file and when i open it, it's a vector again. So i
    know that it is a vector, but why won't it show up in fireworks
    CS3.
    I also noticed the drop-down bar with the different image
    types. Is fireworks auto-optimizing? If so, is there a way to turn
    this off? I want to do my own optimization and I want to view the
    fireworks document the way it is.
    Much help would be greatly appreciated.
    Thanks,
    Logan
    Sutherland Design Agency

    Anagon wrote:
    > okay i'll try that and post my result here.
    >
    >
    FW CS3 should import your AI file without downsaving it to AI
    8. Keep in
    mind though, FW always displays vectors as they would appear
    when
    exported as bitmaps (browsers don't understand vector files
    without a
    helper application). If you are zooming in (not scaling) on
    the canvas,
    the artwork will start to look pixelated, because the stroke
    and fills
    are being displayed as bitmaps. Scaling the image should have
    no
    detrimental effect on the vector.
    Jim Babbage - .:Community MX:. & .:Adobe Community
    Expert:.
    http://www.communityMX.com/
    CommunityMX - Free Resources:
    http://www.communitymx.com/free.cfm
    .:Adobe Community Expert for Fireworks:.
    Adobe Community Expert
    http://tinyurl.com/2a7dyp
    See my work on Flickr
    http://www.flickr.com/photos/jim_babbage/

  • My desktop photo disappears when I reboot iMac, replaced with Mac default image. please help?

    My desktop photo disappears when I reboot iMac...replaced with default apple image. does anyone know a fix?

    First, try to delete the Desktop settings file. First, open Finder, select Go menu > Go to Folder, and type ~/Library/Preferences. Then, delete "com.apple.desktop.plist" and "com.apple.systempreferences.plist", and restart your computer. Finally, change the wallpaper and see if it stays after restarting your computer
    If that does not work try
    open the Applications Support folder and then look for the Dock folder and open that. There are two files, one of which is "desktoppicture.db". Move this file to the trash and securely delete it. Restart the computer. A new "desltoppicture.db" will be created on startup.
    Finally, reset your desktop picture again using System Preferences.

Maybe you are looking for

  • Preview.app - Behaviour of Tiger's Preview for Leopard's Preview?

    Hi there, I am a web designer and I use Leopard's Preview to look at different pages of a website's design. This includes opening several pages as images and switching between them. And this is where I'm having alot of issues with Leopard's Preview.a

  • Computer/laptop to tv display

    I want to hook my computer up to my tv to play my streaming netflix videos, what cables are required and what are the best companies.

  • Feature Request - CSS code generation for advanced font - type options

    Thanks to everyone for the amazing work done in Photoshop and Illustrator to enhance the ability to generate and use character and paragraph styles translated to CSS. The last two releases have brought designers something they could only dream of and

  • What is Adobe Bridge?

    What is Adobe Bridge and can I delete it from my Apps folder?

  • Inventory Report Problem

    Hi all, There is problem in inventory report. When i run as report as on date (31.12.2008) total is coming correct its matching with R/3. But if i add stock of all the material then its not matching. eg.. Material        qty    val m01              1