Help me to view my mistakes in mouseMoved

Hallo !
I've been around here looking for an article or discussion about mouseMoved..but none has answered my problem. Hmm..how do I describe my problem...ok, sorry for the long ass post here, but I am not a good expainer.
The Case:
I want to make a cell which has 45 x 45 pixels size. So, I made a class namely BlankCell by extending JPanel. BlankCell has 2 events, they are mouseClicked and mouseMoved (exactly mouseHover but there is no mouseHover in Java).
What I want to do:
To make a HOVER State by loading another image. And when the mouse is not over the BlankCell it returns to Normal state.
With my code below...the image will turn into hover state as soon as the cursor enters JFrame (in the main method and I didn't include the main method here). And when you see in the Inner Class of MyMouseMotionAdapter, you'll see that I've tried to use a flag:
private boolean hover = false;
But still...the problem exists.
Where did I make mistakes ? Are there ways to do this better, I mean maybe I can set a boundaries or something like that ? Please help !
Thank you for your time to review this...
Here's my code:
public class BlankCell extends JPanel {
   private ImageIcon img;
   //to hold image name on normal state
  private final static String IMAGE_NORMAL_STATE_NAME = "BlankCells";
   //to hold image name on hover state
   private final static String IMAGE_HOVER_STATE_NAME = "BlankCellsHover";
         //initialize BlankCell by loading image
      public BlankCell () {
         //load image
         img = new ImageIcon (getClass().getResource("img/" + IMAGE_NORMAL_STATE_NAME + ".gif"));
         //all image's width and heights are the same (45 x 45 pixels)
         width = img.getIconWidth ();
         height = img.getIconHeight ();
            // register MouseMotionListener
         addMouseMotionListener (new MyMouseMotionAdapter (this));
      } // end constructor
   // accessor methods...but I didn't write it here, it would be too long
   //Inner class to Handle Mouse Motion Listener
   class MyMouseMotionAdapter extends MouseMotionAdapter {
      private boolean hover = false;
      BlankCell blankCell;
      public MyMouseMotionAdapter (BlankCell blankCell) {
         this.blankCell = blankCell;
      //To Handle Mouse Entered
     public void mouseMoved (MouseEvent me) {
         if (this.hover != (contains(me.getX(), me.getY()))) {
            this.hover = ! this.hover;
            if (this.hover) {
              // "mouse hover" code
             img = new ImageIcon (getClass().getResource("img/" + IMAGE_HOVER_STATE_NAME + ".gif"));
          } else {
              // "mouse leave" code
             img = new ImageIcon (getClass().getResource("img/" + IMAGE_NORMAL_STATE_NAME + ".gif"));
          } //end inner if - else
     } //end  outer if-else
            repaint();
     } //end mouseMoved method
   } //end inner class MyMouseMotionAdapter
} //end BlankCell class

Hi,
JPanel. BlankCell has 2 events, they are mouseClicked
and mouseMoved (exactly mouseHover but there is no
mouseHover in Java).but there are mouseEntered(...) and mouseExited(...). Override them
both in your listener.
To make a HOVER State by loading another image. AndWhen the mouseEntered(...) method is called set your hover-image.
when the mouse is not over the BlankCell it returns
to Normal state. When the mouseExited(...) method is called set your normal-image.
// register MouseMotionListener
addMouseMotionListener (new MyMouseMotionAdapterapter (this));and instead of calling addMouseMotionListener(...), use the method addMouseListener(new MyMouseMotionAdapterapter (this))
Stephan

Similar Messages

  • Help on Materialized view

    Hi all ,
    I need some help on materialized view. I have to make a MV in dbms_dtm schema
    I have 2 tables like below
    sales and orduct
    salescolumns: salesid,prodid,subid,charges
    and product columns: subid and billid
    sales.subid = product.subid.
    i need a materialized view for this columns salesid,prodid,sum(charges),count(subid) and billid in dbms_dtm.
    have to create another materialized view for below tables
    order and ordertype
    order columns: orderstaus,ordertype,address,ordertypeid
    ordertype columns: ordername,subordername,ordertypeid
    order.ordertypeid = ordertype.ordertypeid
    need a materialized view for columns orderstaus,orderstaus,ordertype,address,ordername,subordername and granularity for this cloumns.
    please some give me some guidens on this issue
    Thanks in advance

    You should read chapters 8 & 9 of the Data Warehousing Guide:
    http://download.oracle.com/docs/cd/B28359_01/server.111/b28313/basicmv.htm
    Just saying "you need a materialized view" doesn't provide enough information on what you need or how you plan to use it.

  • "Help" in List View, Why?

    Noticing some odd behavior: when you right click on any object in list view, the first contextual item is "Help". In icon or column view there is no "Help" and the first selectable action is "Open". Oddly, "Help" in list view does nothing. Can anyone explain this behavior. More importantly, can anyone tell me how to change it?

    Limnos wrote:
    What do you want it to do?
    Actually, I'd prefer it not be there. I'd like the first selectable item to be "Open" regardless of what view I'm in.

  • Digital Publishing Suite Help | Creating custom viewer apps for the iPad and iPhone

    This question was posted in response to the following article: http://helpx.adobe.com/digital-publishing-suite/help/create-custom-viewer-app-ipad.html

    The Approval Status section is no longer in DPS App Builder, but this reference wasn't removed. You can submit your app to the gallery using this form:
    https://adobeformscentral.com/?f=ozjJFvlBionBofBtd-wjbQ#

  • I have a HD video clip (MPEG 4), able to watch in VLC in my Mac-book-pro, but not in Quicktime player and FCP X - just seen as full green. Help please to view in FCP X by changing the format or what ever thats required.

    I have a HD video clip (MPEG 4), able to watch in VLC in my Mac-book-pro, but not in Quicktime player and FCP X - just seen as full green. Help please to view in FCP X by changing the format or what ever thats required.  Thank you.

    Thanks for your reply. This video was recorded by my own professional camera, Sony PMW EX 3, two years back. But I am neither a professional cameraman nor an editor. I am just like a beginner in both.  I didnt have space in my storage device, so I just copied all my clips, thinking I can edit it latter, without recompressing or editing or whatever I should have done it at that point of time.  Now I need to edit it and use it in my profession. I am very upset.  Please help me in going step by step to get it in FCP X for editing.  Also I would like to know, do I need to buy the Compressor 4 for any reason. I dont mind in buying, if you think it is going to be useful for some reason.  Thank you very much in anticipation for any kind of proper guidance.

  • E4 support Help, editor and view management, text editors, resource views, preference ?

    Hi friends,
    I am create pure E4 RCP Application but E4 support Help, editor and view management, text editors, resource views, preference and properties or not ? and how to support? any other solution ?
    i am confusing E3 use or E4 in my application ?
    Please help me friend.

    Ad help: There was a recent thread on this forum where someone reported
    that he managed to include the help stuff
    Ad text-editors: No not really although the base framework
    org.eclipse.text and org.eclipse.jface.text can be used
    Ad preference: The core stuff is there but the preference dialog as you
    know it from the IDE is not available
    I think the biggest amount of work is to get a decent text-editor for
    your application. It naturally depends on what text you need to edit if
    it is pure ASCII it is trivial, syntax coloring is not a big deal either.
    Tom
    On 16.07.15 10:50, Lalit Solanki wrote:
    > Hi friends,
    > I am create pure E4 RCP Application but E4 suppor Help, editor and view
    > management, text editors, resource views, preference and properties or
    > not ? and how to support? any other solution ?
    >
    > i am confusing E3 use or E4 in my application ?
    >
    > Please help me friend.

  • Help needed to view documents send in .pdf portfolio - only gray screen visible

    Various clients are complaining that they are unable to view/retrieve documents I have forwarded in .pdf portfolio format. All they see is a blank - grey - screen.   Any help to resolve this would be appreciated.

    Make sure they are opening the files in Adobe Reader or Acrobat only, or in Internet Explorer using one of those. Make sure you understand the various ways they might open the file without using Adobe Reader or Acrobat, such as in FireFox, Chrome or Safari, or Preview on a Mac. Make sure they have a sufficiently up to date copy of Reader/Acrobat too.

  • HELP! Cant view my photos on publish site...

    Having created my website in iweb, I have added a photo gallery, once the site is 'published' no one can view the photos on the big wide web, have deleted page and re-designed, re-added, but no joy, can anyone help and advise? I'm at a complete blank and really dont know what to do, please help!
    Thanks in advance

    Glad someone can see the pics, I can see it on my Mac but hubby, family and friends are still on PC and cant see gallery at all, they get the an error that says 'undefined' is null or not an object line 46Char
    Really cant understand whats going on, should I try a different version of displaying my pictures?? Am open to suggestions!

  • Help with Paged view dataset!

    I'm new to Spry and not really a programmer, but I'm sure
    what I'm trying to do is pretty simple, can anyone help?
    Here's what I'm trying to do:
    - I have created a dataset (dsProjects) which contains 7 rows
    (one of the column values is 'Proj_id')
    - I have created a paged view dataset (pv1) based on
    dsProjects. The page count is 4 - so there are 2 pages I can
    navigate through.
    What I want is when there is a URL parameter (Proj_id), pv1
    will show the correct page containing the row that has the same
    column value for 'Proj_id'
    i.e. when I click on this link
    http://www.ollybaker.com/projects.php?Proj_id=11
    pv1 should display Page 2 of 2 because the row containing the
    Proj_id column value of 11 is on page 2.
    but this doesn't happen... any ideas what I'm doing wrong?
    The code is below:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml"
    xmlns:spry="
    http://ns.adobe.com/spry">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=UTF-8" />
    <title>Untitled Document</title>
    <script src="SpryAssets/xpath.js"
    type="text/javascript"></script>
    <script src="SpryAssets/SpryData.js"
    type="text/javascript"></script>
    <script src="SpryAssets/SpryURLUtils.js"
    type="text/javascript" ></script>
    <script src="SpryAssets/SpryPagedView.js"
    type="text/javascript"></script>
    <script type="text/javascript">
    var dsProjects = new
    Spry.Data.XMLDataSet("xml/recent_work.php", "export/row");
    dsProjects.setColumnType("Proj_id", "number");
    dsProjects.setColumnType("image", "image");
    //Set up pv variables to display information about the paged
    views
    var pv1 = new Spry.Data.PagedView( dsProjects ,{ pageSize: 4
    var pvInfo = pv1.getPagingInfo();
    var params = Spry.Utils.getLocationParamsAsObject();
    params == 1;
    //Set up pv variables to display information about the paged
    views
    pv1.addObserver({ onPostLoad: function(ds, type) {
    var row = pv1.findRowsWithColumnValues({"Proj_id":
    params.Proj_id}, true);
    // If we have a matching row, make it the current row for the
    data set.
    if (row)
    pv1.goToPageContainingItemNumber(row.ds_RowID);
    </script>
    </head>
    <body>
    <div spry:region="pv1">
    <table cellpadding="10" cellspacing="0">
    <tr>
    <th>Proj_id</th>
    <th>Image</th>
    </tr>
    <tr spry:repeat="pv1">
    <td>{Proj_id}</td>
    <td><img src="images/{image}" width="100"
    height="50"/></td>
    </tr>
    </table>
    </div>
    <p spry:region="pvInfo" spry:repeatchildren="pvInfo">
    <a spry:if="{ds_CurrentRowNumber} != {ds_RowNumber}"
    href="#"
    onclick="pv1.goToPage('{ds_PageNumber}')">{ds_PageFirstItemNumber}-{ds_PageLastItemNumber }</a>
    <span spry:if="{ds_CurrentRowNumber} == {ds_RowNumber}"
    class="currentPage">{ds_PageFirstItemNumber}-{ds_PageLastItemNumber}</span></p>
    <br /><br />
    </body>
    </html>

    You have to make 2 changes:
    - Tell findRowswithColumnValues() to include filtered items
    (items not in the current page) in your search. So change:
    var row = pv1.findRowsWithColumnValues({"Proj_id":
    params.Proj_id}, true);
    to:
    var row = pv1.findRowsWithColumnValues({"Proj_id":
    params.Proj_id}, true, true);
    - Lastly, you are calling the wrong function to show the
    page:
    pv1.goToPageContainingItemNumber(row.ds_RowID);
    It should be:
    pv1.goToPageContainingRowID(row.ds_RowID);
    --== Kin ==--

  • Help, i cannot view my photos

    I have the blackberry curve, I received it yesterday and took about 8 pictures and I can view them on my media files.
    Today I took pictures however I couldn't see them in my media picture files. When I receive or take pictures I casnnot view them. Please help.

    Hi helenfrances and welcome to the forums!
    First try a battery pull:
    No data will be lost when doing the following: pull the battery while the device is ON.
    Replace after a minute, Let the device reboot 1-3 min, see if the problem is fixed.
    You can look for the pictures using the explore command. Let us know if they are on the device memory or on your media card.
    Thanks,
    Bifocals
    Use the explore Command
    8900 user manual
    Click Accept as Solution for posts that have solved your issue(s)!
    Be sure to click Like! for those who have helped you.
    Install BlackBerry Protect it's a free application designed to help find your lost BlackBerry smartphone, and keep the information on it secure.

  • Need Help with Crystal viewer and ActiveX

    Hi !!
    I have a problem that i cant seem to be able to solve. I had alot of help from the forum but i think i got everything mixtup now...
    From my addon i can print with CrystalReport Viewer or i cant print a Crystal report directly to my default printer, so thats good and working well. The problem is with Crystal Viewer that drags on the SBO screen and stays on the task bar.
    It is strongly recommended to use an Activex to display my Crystal Viewer report. I tried so many differrent ways allways ending up with class id errors, or private class errors.
    My report is called c:\report.rpt
    My Working CrystalViewer form is called 'frmCRV'
    Can some one help me thru this last step...  I tried with the Activex sample in SDK but i think i dont have to use the Tree function ??? am i right ??
    I'm running on SBO 2005 SP1 PL3
    Crystal Report .net V10 and .net for code.
    Thanks you all for your patience.

    Hi Again !
    I can now open a form with an Activex part but i cant pass my CrystalViewer in it. Always says specified cast not valid.
    Thanks

  • 30 inch HELP  only 90% view (movable) in any resolution

    30inch ACD working fine for 1 year, today while working, the view changed to about 90% of the full background screen. When I move the mouse or pen (wacom) it moves entire background screen so it is all accessable, but a pain to use that way as any movement of the mouse moves the entire screen.
    -Tried changing resolutions, It still happens no matter which one I choose.
    -Removed Wacom tablet and Software, still happens with basic mouse.
    -Did shut downs, and restarts, no change. BUT screen comes up OK till the end of the boot, then, just before the desktop icons show up, the screen expands about 10 %

    Thanks for the help/info, Command-option 8 did it.
    No scroll wheel (old mouse/only use pen/tablet)
    I must have hit the 8 while working with the buttons on the tablet. Surprised the multiple restart/shutdown did not clear it.

  • Please help about Custom View fo EditorKit

    Thank You for reply
    TextArea in Visual Studio .NET is somehow displayed like that.
    - public class Test{
    |
    | + public Test(){
    | | ....
    | _ }
    |
    | + public int load(){
    | | ......
    | _ }
    |
    and if u press + symbol, method code is displayed.
    thats why i want to customized EditorKit's Views
    Please Help Me....
    Thanks..

    Thank You for reply
    TextArea in Visual Studio .NET is somehow displayed like that.
    - public class Test{
    |
    | + public Test(){
    | | ....
    | _ }
    |
    | + public int load(){
    | | ......
    | _ }
    |
    and if u press + symbol, method code is displayed.
    thats why i want to customized EditorKit's Views
    Please Help Me....
    Thanks..

  • Need Some Help? Icon view Problems

    Just recently my finder has been acting up. While in finder and viewing in Icon layout, Leopard has been taking a while to load icon folders & images. It's only about 5 sec, but much slower than before. The problem only occur in Icon veiw. All other views load folders and images quickly (List, Coverflow, ect.) Has anybody encountered this problem and knows how to solve it?

    Welcome to Discussions.
    Have you installed something recently that could be the cause?
    It's been reported that setting the Mouse double-click speed to maximum in System Preferences - Keyboard & Mouse helps (as odd as it sounds): http://forums.macrumors.com/showthread.php?p=5284495#post5284495
    Perhaps it will help to reset the PRAM/NVRAM: http://support.apple.com/kb/HT1379.
    /p

  • Help in materilized view???

    Hi All:
    Can anybody tell why we create materlized view? Whats the difference in syntax and logic in creating simple view and materlized view. I have made many simple view. But this first time I am making materlized vuew. I only know that it decreases the execution time. Please somebody help me in this . Thanks
    Ali

    Materialized view really gathers data from tables, while simple view is just remembered select stamement. MV's takes space on disk - views aren't. You can use materialized view in distributed databases or for often used joins or goup by selects. Materialized view fastens your queries because when you make select from MV which is for example join of two tables there is no really joining but just reading data from MV. You shold read also sometihng about refreshing MV.

Maybe you are looking for

  • HP Laserjet Pro P1102W will only communicate with 1 computer wirelessly

    I am using Windows Pro 64 bit on 2 laptops. I have been able to configure the printer to work wirelessly on one of the laptops, but the 2nd laptop does not communicate with the printer. The 2nd laptop can see the printer, but not communicate with it

  • Extracting HTML data in BSP from Browser

    Hello,         I am displaying an Adobe Interactive form as HTML using an IFRAME in BSP, I know there is another way of using Adobe Interactive form in BSP, but it would occupy the entire BSP page and would overwrite any other BSP elements and they w

  • Sorting and formatting in Numbers with iPad 2

    I am going to send feedback to Apple about this, but I wanted to let the community help, if I am incorrect and these things are actually possible. 1. I can only sort by one column. I want to be able to create a sort priority. For example, I want to s

  • Password hint required in password reset through console

    We are using OID to handle our user database. One of the problems we are having is that the forgot password feature through the Oracle Identity Management Provisioning Console doesn't really enforce required fields for password reset. I currently hav

  • Is it possible to 'reset/clean' your main user account?

    For various reasons I'd like to 'reset' my original user account. Basically keep all my apps but wipe my settings clean and ect. Is this possible? If so how?