Solved

problem with Object flicker on MouseEvents

Posted on 1998-11-11
4
214 Views
Last Modified: 2010-03-30
public class Applet1 extends Applet
{
    private class MyEvent implements java.awt.event.MouseListener
    {
        public void mouseClicked (java.awt.event.MouseEvent mlEvent)
        {
        }
       
        public void mousePressed (java.awt.event.MouseEvent mEvent)
        {
        }
       
        public void mouseReleased (java.awt.event.MouseEvent mEvent)
        {
        }

        public void mouseEntered (java.awt.event.MouseEvent mEvent)
        {
        }

        public void mouseExited (java.awt.event.MouseEvent mEvent)
        {
        }
       
        private void FretBoard_Clicked (Object obj, java.awt.event.MouseEvent mlEvent)
        {
        }
    }

    //{{DECLARE_CONTROLS
   /}}
   
  public void init()
  {
  //{{INIT_CONTROLS
 setLayout(null);
 setBounds(0, 0, 640, 480);
 
 ImageButton imgFret = new ImageButton();
 imgFret.setBevelHeight(0);
 imgFret.setImageURL(new java.net.URL("file:///C:/FretBoard.jpg"));
  imgFret.setBorderColor(new java.awt.Color(16777215));
  imgFret.setButtonColor(new java.awt.Color(16777215));
  imgFret.setImageStyle(symantec.itools.awt.ImageButton.IMAGE_NORMAL);
  imgFret.setUseOffset(true);
  imgFret.setNotifyDelay(0);
  imgFret.setBounds(24, 24, 602,155);

  add (imgFret);

 // Add MouseListener to the Image Component
 imgFret.addMouseListener (new MyEvent());
 //}}
}
}  



Hello,
The above extract of code places an image (extends java.awt.Component) onto a panel and adds a listener for the mouseevents.

It is possible to click on the images but the image flickers everytime the mouse button is depressed.  How can I avoid this flicker?

Thanks for any help you can offer,

Rob.
0
Comment
Question by:robertod031297
  • 3
4 Comments
 
LVL 16

Expert Comment

by:heyhey_
ID: 1227222
there are two possible reasons for flickering
1. this can be a platform problem - try the applet with different browsers & appletviewer
if it does not depends on the JavaVM implementation then
2.) it should be Symantec's fault
  ( I saw this line 'symantec.itools.awt.ImageButton.IMAGE_NORMAL')
check the documentation from symantec and maybe some examples ...

:-) i've seen many images that does not flicker. I'd recomend you not to use third party componnent for simple applets - at least if you write them yourself, you'll know exactly what happens ...

hope this helps
  heyhey
0
 
LVL 16

Accepted Solution

by:
heyhey_ earned 50 total points
ID: 1227223
there are two possible reasons for flickering
1. this can be a platform problem - try the applet with different browsers & appletviewer
if it does not depends on the JavaVM implementation then
2.) it should be Symantec's fault
  ( I saw this line 'symantec.itools.awt.ImageButton.IMAGE_NORMAL')
check the documentation from symantec and maybe some examples ...

:-) i've seen many images that does not flicker. I'd recomend you not to use third party componnent for simple applets - at least if you write them yourself, you'll know exactly what happens ...

hope this helps
  heyhey
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 1227224
Sorry :((
damn browsers ...
0
 

Author Comment

by:robertod031297
ID: 1227225
Hello heyhey_ (wtf?)

I spotted the problem in reading your answer.  This component was originally a blank imagebutton and I wanted to replace the imagebutton with a plain image.  The fact that it's a button means it responds visually to mouseclicks and that explains my flicker - it's just the button responding.

Take Care,

Rob.

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question