Mouse over solution for jdk1.0

hi all,
I am interested in making the equivalent of a mouse over solution for a java applet.
Basically I'll have approximately 100 Rectangle objects representing images on the applet.
When the person moves the mouse over these 100 rectangle objects, i'll use contains() method to determine if the mouse is over the object in question.
If true, the image will be changed to represent the mouse over event .
I thought for a msecond about looping through all the rectangle objects each time the mouse moves. but that seemed impractical since the mouse can move pretty quickly.
It seemed to me the best option was to extend the Rectangle object and put an event listener on it . so that the Rectangle object can be triggered at the same time or individually as needed in response to the mousemove event .
Does anyone have any thoughts about that ?
does anyone know how I would possible implement something like that for java 1.0
thanks
stev

it seems like I have to extend Component some how to get access to enableEvents method.
Here is my class
class ListeningRectangle extends Rectangle{
     public ListeningRectangle(int w, int x, int y, int z, Component c){
          super(w,x,y,z);
          c.enableEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK);
     public void mouseMoved (MouseEvent me) {
     System.out.println("event has been received by rectangle");
I am using this class in conjunction with a java applet (targetted to 1.0-1.1 ).
I'm passing a reference of the applet in to create this ListeningRectangle like this
new ListeningRectangle(a,b,c,d,this);
my objective is to have about 100 different rectangle areas defined on the java applet.
and when the person moves the moves the mouse of the applet rapidly, only the appropriate ListeningRectangle object would respond.
any ideas on how to get this done ? ?
The full code is below
stephen
================================
full source code below
import java.applet.*;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
public class TestEventHandler extends Applet implements Runnable{
     ///variables
     public static Color bgColor = Color.blue.darker();
     private Thread thread;
     public Graphics offGfx;
     private Image offImg;
     private Image basicOffImg;
     public static int xlen;
     public static int ylen;
public ListeningRectangle lr;
     ///methods
     public void init(){
     xlen = size().width;
     ylen = size().height;
     basicOffImg = createImage(xlen, ylen);
     offImg = basicOffImg;
     offGfx = offImg.getGraphics();
     setBackground(bgColor);
     offGfx.setColor(bgColor);
     offGfx.fillRect(0, 0, xlen, ylen);
     offGfx.setFont(new Font("Arial, Helvetica, Helv", 1, 15));
     FontMetrics fontmetrics = offGfx.getFontMetrics();
     offGfx.setColor(Color.white);
     String s = "pleaseWait";
     offGfx.drawString(s, xlen / 2 - fontmetrics.stringWidth(s) / 2, ylen / 2);
          lr = new ListeningRectangle(20,20,50,50,this);
          offGfx.fillRect(20,20,50,50);
     public void start(){
     if(thread == null)
          thread = new Thread(this);
          thread.start();
     public void run(){
          while(thread != null){
     try
          Thread.sleep(100L);
          catch(InterruptedException _ex) { }
     public void stop()
          if(thread!=null)
     thread = null;
     public void update(Graphics g){ paint(g);}
     public void paint(Graphics g){
     g.drawImage(offImg, 0, 0, null);
public boolean mouseDrag(Event event, int i, int j)
if(true)
return false;//means ripple
} else
return true;//means do not ripple for jvm1.0
public boolean mouseMove(Event event, int i, int j)
if(true)
return false;
} else
return false;
class ListeningRectangle extends Rectangle{
     public ListeningRectangle(int w, int x, int y, int z, Applet c){
          super(w,x,y,z);
          c.enableEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK);
     public void mouseMoved (MouseEvent me) {
     System.out.println("event has been received by rectangle");
}//end of class

Similar Messages

  • Mouse over event for every word inside a text?

    I want to do a separate mouse over event for every word inside a text.
    or at least get the string below the mouse cursor.
    any hint?
    henry

    There are no events for it but you can use TextField.getCharIndexAtPoint() to determine the character where the mouse is over, and from there you can work out the word where the mouse is over.

  • How to define mouse-over event for a icon

    Hello,
    I have defined a icon for a panel in my plugin. I want that the icon should be changed on mouse over event.
    The code for icon is given below.
    resource PanelList (kDNDListsPaletteResourceID) {
                        // 1st panel in the list
                        kDNDListsPaletteResourceID,                    // Resource ID for this panel (use SDK default rsrc ID)
                        kIBPluginPluginID,                                             // ID of plug-in that owns this panel
              #if CSVER >= 4
                        kIsResizable,
              #else
                        isResizable,
              #endif
                        kIBClientPluginDNDPanelWidgetActionID,          // Action ID to show/hide the panel
                        kIBClientPluginDNDPanelTitleKey,               // Shows up in the Window list.
                        "",                                                           // Alternate menu path of the form "Main:Foo" if you want your palette menu item in a second place
                        0.0,                                                                                     // Alternate Menu position Alternate Menu position for determining menu order
                        kPlusIconPNGIconRsrcID, kIBPluginPluginID,                                                            // Rsrc ID, Plugin ID for a PNG icon resource to use for this palette
                        c_Panel
    Where should I give the resourceID of the other icon?

    Hi
    First change the name from kPlusIconPNGIconRsrcID to kPlusIconPNGIconIRsrcID
    so "I" will indicate that your icon is inactive
    Create another resource id like:
    #define kPlusIconPNGIconIRsrcID 15
    #define kPlusIconPNGIconARsrcID 15
    Define paths to the icons
    resource PNGA(kPlusIconPNGIconIRsrcID) "../res/icons/PLUS_ICO_23_I.png" // Inactive icon
    resource PNGR(kPlusIconPNGIconARsrcID) "../res/icons/PLUS_ICO_23_A.png" // Active icon
    Regards
    Bartek

  • Mouse over effect for Button

    Hi,
        I have a button inside a vbox. I need to give mouse over effect to that button. Please give me the code.
    Regards,
    Jayagopal.

    Pls let me know if you have any issue with solution below:-
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
        <![CDATA[
            import mx.effects.effectClasses.ResizeInstance;
            private var resizeInstance:ResizeInstance;
            public function mouseHandler(event:MouseEvent):void
                    if (resizeInstance)
                        resizeInstance.reverse();
                    else
                        resizeEffect.play([event.currentTarget],event.type==MouseEvent.MOUSE_OUT);
    ]]>
    </mx:Script> 
    <mx:Resize id="resizeEffect" heightFrom="22" heightTo="50" 
        effectStart="resizeInstance = ResizeInstance(event.effectInstance);"
        effectEnd="resizeInstance=null"/>
    <mx:VBox width="500" height="500" horizontalAlign="center" verticalAlign="middle">
        <mx:Button label="Sample Button" buttonMode="true"
        useHandCursor="true" mouseOver="mouseHandler(event)" mouseOut="mouseHandler(event)" />   
    </mx:VBox> 
    </mx:Application> 
    with Reagrds,
    Shardul Singh Bartwal

  • Mouse over speed for opacity change

    how can i edit the speed for the change of opacity while on mouse over
    this is the sample that i want to create http://www.northlandscapes.com/#!home help please.
    i will really appreciate it. thanks

    jQuery can do that.  :-))
    http://bavotasan.com/tutorials/creating-a-jquery-mouseover-fade-effect/
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://alt-web.com/
    http://twitter.com/altweb

  • Supported pdf versions and mouse over problem for Xcelsius 2008 SP3

    Hi,
    Have below queries regarding Xcelsuis 2008 SP3.
    (1) Encountered last character truncation problem for the x-axis and y-axis labels when viewed using adobe reader versions higher than 9.0.0. Viewing the pdf doc using adobe reader v9.0.0 has no label truncation problem.  Preview in Xcesius is also ok.
    (a) Y-axis label - eg. No. of students. The last char [s] is truncated when exported to pdf.
    (b) X-axis label u2013 when labels are oriented vertically, they are very close to the x-axis. The last char is truncated.
    Please advise what is the supported pdf versions for Xcelsius 2008?
    Any workaround to overcome the truncation problem?  
    (2) Mouseover in charts. When the series name has < symbol, Xcelsius truncates the remaining text that's after the < symbol.
    Is this a limitation that < symbol cannot be used? Any workarond for this? Any document to reference on the limitations of Xcelsius? e.g. If series name is '>1 and <=2', mouse over desc becomes '>1 and '.
    Thanks and Regards.

    Hi ,,There are a lot of developments in SP3 version. But some loopholes which I caughtu2026
    1. The value button/spinner is no longer supporting a cell having some formula. Also the time it is taking to load data which depends on value button/spinner as a result of change in it, is comparably very high as compared to earlier version.
    2. Still there is no component like pre-load animation. So it is difficult to know weather the tool is running or not when one selects an option in some selector.
    3. One still finds it difficult to work with a large range of data/complex spread sheet in xcelsius as it crashes while exporting.
    4. Export to excel still needs Tomcat Web server,Java help. It is not simplified.

  • How to change mouse-over label for a mx:CandleStickChart?

    I have an <mx:CandleStickChart .../> graph and want to change the default
    labels on the mouse-over window.  For example by default, the mouse-over window displays:
      line1: some label
      line2: open: #1
      line3: close: #2
      line4: high:  #3
      line5: low: #4
    I want to change the words "open", "close", "high", "low" to something else.  I optionally want to not show  the "close" line.
    Do you have any suggestions on how to do this?  If you do, please provide a short example.
    Thanks for taking the time to help.

    Hi
    First change the name from kPlusIconPNGIconRsrcID to kPlusIconPNGIconIRsrcID
    so "I" will indicate that your icon is inactive
    Create another resource id like:
    #define kPlusIconPNGIconIRsrcID 15
    #define kPlusIconPNGIconARsrcID 15
    Define paths to the icons
    resource PNGA(kPlusIconPNGIconIRsrcID) "../res/icons/PLUS_ICO_23_I.png" // Inactive icon
    resource PNGR(kPlusIconPNGIconARsrcID) "../res/icons/PLUS_ICO_23_A.png" // Active icon
    Regards
    Bartek

  • Xcelsius/Dashboard Design - mouse over capability doesn't work/losing hover

    Hello there,  I am currently in a tough situation.  If any Xcelsius gurus can provide me with a solution, I would very much appreciate your help.
    I currently have a dashboard with pie chart component in the default view.  It has a radio button with two values.  The mouse over doesn't work when the dashboard is loaded.  However, when I make a selection in the radio button, the mouse over works for both the options.  I have noticed this is a bug but if anyone has a solution or way around it, let me know.
    Another issue - I have a 'All' view and 'Region' views in the menu bar.  When a user clicks on a particular Region, then clicks all and goes back to a region, I lose the drill down capability on the pie chart thats on the Region view.  initially, the mouse over and drill down works fine.  However, after going to the All view and coming back to a region, this capability is lost.  It acts the same way as the problem above.  User can't hover nor drill down.  If anyone has a solution to this, let me know.

    FYI this is the article on the main forum page:
    Announcement: New to Spry, or  the Spry forums?
    Hide Details
    Before you post a topic please verify that:
    You are using the latest Spry files
    The latest version of the Adobe Spry Framework is 1.6.1, this is the same version that ships with Dreamweaver CS4. If you use Dreamweaver CS3 (uses Spry 1.4), its wise to upgrade your files to the latest version. This can easily be done using the Spry Updater that can be found here.
    After that we will have a look at your code.
    Ben

  • Mouse Over values disappear

    Hi,
    the Mouse Over values for our Xcelsius 2008 sp2 charts disappear.  We do have the feature checked for all charts.
    The workaround is to make a different combo box selection and the mouse over value seems to start working again.
    Is anyone else experiencing or know how to fix this?  Is this a bug?
    I have searched the SAP Business Objects forums and the internet, but, I have not found a solution.
    Thanks in advance,
    Al

    Hi I am also getting the same issue like u.....
    Please let me know the solution if u found the answer?
    Thanks & Regards,
    Mallareddy.

  • Mouse over events on alv report?

    Hello,
    i want to make mouse over event for rows of a alv report.When mouse is on a row there will be shown explanations.
    how can i do this?
    thanks inn advance.

    Cem ,
    Please follow the code mentioned in the links below :
    Hotspot in ALV grid
    http://wiki.scn.sap.com/wiki/display/Snippets/Interactive?original_fqdn=wiki.sdn.sap.com
    Thanks
    Ankit

  • Mouse Over Value in Pie Chart

    I have two questions -
    1. How do i restrict the no. of decimals in the Mouse Over values for Percentage in a Pie Chart ? The numeric values i can control but the percentage (which the system calculates) seems to be set at default two decimal places.
    2. While displaying the labels even though i am using the ouside end, inside end etc options - i can't seem to control the overlapping of a few labels. Offsetting is something that i need to do by hit and trial. too slow. and not all need to be offsetted. Can i selectively offset for a data point ?
    Please help....Cheers...

    Hi:
       For question1, do you mean the "Data Label->Percentage" right? I think the "Mouse-Over Values" could be set decimal places easily from  "Appearance->Text->Mouse-Over Values", but for "Data Label->Percentage" there is no direct way to show its decimal places. You can use "Label" component to build your percentage you like manually.
      For question2, if all position setting could not fit your need, you can also use label component to build your custom Data Labels.

  • Mouse over display stays on top when Firefox isn't front app

    FireFox 3.6.10 but has been going on a few versions.
    On startup the FireFox icon I double click on my desktop is in the same screen location as one of the hot bar items. When Firefox finishes loading it displays the mouse over information for that hotbar item despite Firefox not being the front application, and mouse being moved. The floating window doesn't go away until Firefox is made the front application, and this blocks the front application.
    Its a minor annoying bug, but happens every time FireFox is launched.

    Hi NicoMan,
    According to your description ,we seem to suffer a performance issue here.
    Have you tried to open the task manager to check the system performance  ? Is there any specific process occupied many system resources ?Will the issue occur only with the specific applications ?
    We can try to restart the Windows Explorer process to have a check.
    If it only occurred with the spefcific two applications ,we can try to end the other application processes manually from the task manager to have a check .
    If this is caused by the specific application ,we may need to look for help from the third party support considering they are all the third party applications .
    Best regards
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • How to make movieclip controlled by button fade in/out on mouse over/out?

    Hi,
    I am new to Flash, and have tried searching numerous forums to the answer to this question, but nothing I try seems to work. Basically I am trying to create a single "Image" that triggers different animations when you mouse over different invisible buttons located on specific areas. The technique I am using is basically spacing out the animations over different frames, and using the gotoAndPlay command specifying the where the relevant animation is located.
    Here is the code from my actions layer with two animations:
    stop(); /*This ensures no animations are playing on the first frame*/
    /*Mouse over event for redbutton1*/
    redbutton1.addEventListener(MouseEvent.MOUSE_OVER, fl_MouseOverToGoToAndPlayFromFrame_2);
    function fl_MouseOverToGoToAndPlayFromFrame_2(event:MouseEvent):void
         gotoAndPlay(2); /*This is the frame where the animaton triggered by redbutton1 is located*/
    /* Mouse Out Event for redbutton1*/
    redbutton1.addEventListener(MouseEvent.MOUSE_OUT, fl_MouseOutHandler_3);
    function fl_MouseOutHandler_3(event:MouseEvent):void
         gotoAndPlay(1) /*takes animation back to the start of timeline where it stops*/
    /*Mouse over event for bluebutton1*/
    bluebutton1.addEventListener(MouseEvent.MOUSE_OVER, fl_MouseOverToGoToAndPlayFromFrame_2);
    function fl_MouseOverToGoToAndPlayFromFrame_2(event:MouseEvent):void
         gotoAndPlay(30); /*This is the frame where the animaton triggered by bluebutton1 is located*/
    /* Mouse Out Event for bluebutton1*/
    bluebutton1.addEventListener(MouseEvent.MOUSE_OUT, fl_MouseOutHandler_3);
    function fl_MouseOutHandler_3(event:MouseEvent):void
         gotoAndPlay(1) /*takes animation back to the start of timeline where it stops*/
    Now basically all I need is some code that means that instead of abruptly starting and stopping the animation, the animation will fade in/out whenever the mouseover/out events are triggered. Note: the animation doesn't have to finish, it basically only plays while the mouse is over.
    Any help would be greatly appreciated.

    It will help oif you show the code for the code-based tweening.  The basics of getting it working with the MOUSE_OVER/OUR commands is fairly straightforward. 
    You have listeners for both events, and the handlers for each listener is where you activate the tweens.  For more seamless functionality it is usually a good idea to have the starting point of the tween be the point where the object currently is (its x or y (or both) propertiy) instead of a fixed value.

  • Mouse over Menu

    Hi,
    how can i deactivate mouse over menu for a column chart?
    I have download Sample7. it does not work, when create a new xlf and use the same objects. nertheless the mouse over menue appears.
    hope somebody can help.
    best regards
    ayla

    Hi Ayla,
    go to the properties of the chart:
    ->Appearance
    ->Text
    ->Deselect the checkbox "Mouse-Over Values"
    Regards
    Victor

  • Thumbnails/Mouse Over's next to Description in report

    Hi
    can we have thumbnails and mouse over’s for every report next to its description in portals?
    Your help in this regard will be appreciated
    Thanks
    Sriman

    Ben,
    This is actually much easier that you are trying to make it.
    Go to your List and edit it. Open any given list entry. Take the existing text in the List Entry Label section and put it inside the span tag. The List Entry Label is the actual text the users see in the list.
    List Entry Label:
    My list entry to Page XXnow becomes
    <span title="My customized description of this list entry">My list entry to Page XX</span>Now when you mouse-over the text in the list entry, you will see the description in the title section appear. This works for ordered lists, tabbed page navigation lists, bulleted lists and more.

Maybe you are looking for

  • What is the best procedure to update from Leopard (or Snow Leopard) to Mavericks?

    The pacient: Macbook Pro A1278 Running 10.5.8 -- but have an Update DVD to 10.6 (Snow Leopard) Got slower in start-up Very slow in power-off (takes lot of time on shut-down!) What is the BEST procedure to update it from Leopard to Mavericks? A) updat

  • Upgrade oracle client 10.2.0.1 to 10.2.0.3 on w2k3 std edition sp2

    hi, new on the forum, hello everybody! I'm looking for info about how to upgrade an oracle client 10.2.0.1 to 10.2.0.3. I'm running the client on a windows server 2003 standard edition with SP2. Several questions: -is it an upgrade or a complete re-i

  • Want to Learn Web page composer ?

    Hi Experts, I want to learn Web Page composer ..... Can you please send me some documents or guide me in some  way how can I start to learn Web Page Composer. Any Help will be appreciated. Thanks, Iqbal

  • Credit memo & debit memo

    Hi guys, What is the difference between customer credit memo and customer debit memo? syam

  • Reverse of GR for some qty in a line item

    Dear Experts, Could anyone please help me. I need to cancel GR of some quantity for a line in PO. For example: in a PO line item 10 there were 4000 qty and all 4000 was received. and then 2000 qty issued to network against a reservation. At first 400