Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

problem with Object flicker on MouseEvents

Posted on 1998-11-11
4
Medium Priority
?
218 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

688 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