Solved

problem with Object flicker on MouseEvents

Posted on 1998-11-11
4
213 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

773 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