Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

problem with Object flicker on MouseEvents

Posted on 1998-11-11
4
Medium Priority
?
219 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 200 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

879 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