How to get mouse events inside the components of a JTable

Hi!
I have question, I think this is related to very basics of swing, however I couldn't find a solution/answer on the web.
I have a JMyTable(a descendant of JTable), and one value on a row/column is a special class, ie. MyClass. for this class I registered a cell renderer, MyRenderer. and this renderer returns a JMyComponent, which is actually a descendant of JComponent.
Now, if I call enableEvents(AWTEvent.MOUSE_EVENT_MASK) in the constructor of JMyTable I get events posted on processMouseEvent method. However, the same doesn't work for JMyComponent. I mean, I call enableEvents, however processMouseEvent method is not triggered.
Could someone explain/help me with this issue?
Thanks,
Ozgur

Your cell renderer components are just that: renderers. They're not added to the table and do not appear in the component hierarchy. This is because tables may be very large and adding components in would be very resource hungry.
See here for details
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
If you want to detect events you will need to listen to events on the JTable itself, and use the rowAtPoint()/columnAtPoint() methods to determine the cell. So for instance where you might want mouseEntered() on your cell component you would have to use mouseMoved() on the table and detect when the cursor moves to a new cell.

Similar Messages

  • How to get a photo inside the little box in the "Lower Third" Sports Theme?

    In iMovie '11, in the Sports theme, in the Text page titled "Lower Third," how can I get a picture of a person inside that little box? That sports theme comes up/shows up at the box "Set Theme": Sports. They are all a fluorescent blue, very nice for name tags if I could get faces/pictures inside those boxes.
    Important: Under :Windows" (in control panel) there is an option to click SPORTS EDITOR. I tried working with that. I tried to put a picture in one of those boxes, but the experiment failed.
    Any ideas?
    -L
    Message was edited by: Lorna from Hawaii

    Lorna from Hawaii wrote:
    ... there is an option to click SPORTS EDITOR. ... I tried to put a picture in one of those boxes, but the experiment failed.
    just drag'n drop from Finder any (... 'any' : shouldn't be a 16MBit monster-sized pic, just a small one, look at the aspect ratio) jpeg into it.
    so, what exactly failed?

  • How to get ACK ID inside the BPM

    Hi,
    In my BPM Scenario,I want to update the database table as soon as the file is created in the destination system.So in the Send step I used Transport Acknowledgement option but I don't know how to get the ACK Id inside the BPM.Please help me.
    Regards,
    Sharmila

    There will be no Ack ID in the BPM.
    Read thru this blog to understand the file adapters ack better,
    /people/michal.krawczyk2/blog/2006/06/22/xi-playing-with-the-file-adapters-acknowledgments
    Regards
    Bhavesh

  • How to process mouse event in the Label control?

    I am now tring a MorphFx program which would like implements a Squeak-Like-Morph operation for JavaFX nodes( include shapes, controls and others). currently it is only a prototype on [http://code.google.com/p/wangzaixiang/wiki/MorphFx]
    and there is webstart demo: [http://wangzaixiang.googlecode.com/svn/trunk/LearnJFX/dist/LearnJFX.jnlp]
    and a applet demo: [http://wangzaixiang.googlecode.com/svn/trunk/LearnJFX/dist/LearnJFX.html]
    There is a problem for new created Label control, which dont fire the "onMousePressed" or other "onMouseXXXX" event, and i have not found any way to do that.
    Can somebody tell me how can i add a onMousePressed event to a label and make it works?
    Very thanks.

    I can confirm the same behaviour when you try to capture eg the mouse clicking events on a progress indicator (also MouseMove). These kind of things are a bit useless most of the time in apps, but nevertheless in fact their event listeners should be correctly implemented or otherwise well documented if not. And in my opinion the javaFx API as well as the language specification/documentation can be far more written in details as it is now. So actually I don't know if SUN wanted that kind of behaviour for controls like that or not.
    Somebody from the javaFx SUN team can answer perhaps ?
    PS
    Of course a workaround with shadow node behind works well if the events will propagate through the label. I didn't test it but think this will work.
    -G
    Edited by: guyvo on Jan 19, 2010 1:50 PM
    Edited by: guyvo on Jan 19, 2010 1:55 PM

  • How to deal with the mouse events when the thread is running

    Hi everybody,
    I have a problem with my program.
    Now I want to present a picture for some time in the Canvas,then automatically clear the screen, but when the user press the mousebutton or keybutton, I want to stop the thread and clear the screen.
    How can I receive the mouse event when the thread is running?
    Thanks,

    I use my code in a GUI applet.
    I try to use the code tag, it's the first time.
                   Image im=sd.getStimulus(obj);
                   if(pos==null){
                        g.drawImage(im, (w-im.getWidth(null))/2,(h-im.getHeight(null))/2,null);
                   }else{
                        g.drawImage(im, pos.x,pos.y,pos.w,pos.h,null);
                   try{
                        sleep(showtime);
    //                    Thread.sleep(showtime);
                   }catch(InterruptedException e){}
                   if(pos==null){
                        g.clearRect((w-im.getWidth(null))/2,(h-im.getHeight(null))/2,im.getWidth(null),im.getHeight(null));
                   }else{
                        g.clearRect(pos.x,pos.y, pos.w, pos.h);
                   }

  • How to get a snapshot of the first frame inside application.onPublish?

    Hi there!
    application.onPublish = function (client, p_stream)
        //How to get a snapshot of the first frame and save it to a specified directory?
        //Or post the snapshot image to a specified URI for restoring?
    Anyone knows how to do this ?
    Regards!

    This can be accomplished 2 ways that i know of ffmpeg and PHP with the php way flash takes a snapshot of the videoframe and then sends it PHP to be saved as a jpeg....with the ffmpeg way you simply batch process the entire directory holding the flv wich is external to flash although this can also be automated using PHP........I can send you a package containing both methods but installation will be up to you.............unless you wanted to pay me to help. I'm busy and can't do probono work right now.

  • Getting mouse events outside of nodes

    Does anyone know how to get a mouse event to trigger outside of a nodes clip area? I am trying to write a game and follow the model/viewer/controller outline. I want the controller to handle the mouse events and the controller have no substance on the screen. Mouse events only seen to work when they are inside a node. My current fix is to make the controller appear on the screen as a giant rectangle of the background color. However if there is a better way I would appreciate it.

    My current fix is to make the controller appear on the screen as a giant rectangle of the background color.That's indeed the classical and recommended way. Or make it transparent. Can be in the background (let the nodes handle the clicks (they can block mouse or not), get all "lost" clicks) or in the foreground (get all clicks, letting them pass through to be handled also by nodes).

  • How to get resume event in app?

    How to get resume event in app?

    Hi,
    Have a look at this
    Windows Phone Application Lifecycle
    I think you are looking about Application_Activated which is explained in detail in the above article.
    Pradeep AJ

  • How to get maximal value from the data/class for show in Map legend

    I make WAD report that using Map Web Item.
    I devide to four (4) classes for legend (Generate_Breaks).
    I want to change default value for the class by javascript and for this,
    I need to get maximal value from the class.
    How to get maximal value from the data/class.
    please give me solution for my problem.
    Many Thx
    Eddy Utomo

    use this to get the following End_date
    <?following-sibling::../END_DATE?>
    Try this
    <?for-each:/ROOT/ROW?>
    ==================
    Current StartDate <?START_DATE?>
    Current End Date <?END_DATE?>
    Next Start Date <?following-sibling::ROW/END_DATE?>
    Previous End Date <?preceding-sibling::ROW[1]/END_DATE?>
    ================
    <?end for-each?>
    o/p
    ==================
    Current StartDate 01-01-1980
    Current End Date 01-01-1988
    Next Start Date 01-01-1990
    Previous End Date
    ================
    ==================
    Current StartDate 01-01-1988
    Current End Date 01-01-1990
    Next Start Date 01-01-2005
    Previous End Date 01-01-1988
    ================
    ==================
    Current StartDate 01-01-2000
    Current End Date 01-01-2005
    Next Start Date
    Previous End Date 01

  • I deleted most visited, latest headlines, getting started, yahoo, youtube, apple in mozilla's folder,how to get it back like the first time i installed? thx

    i deleted most visited, latest headlines, getting started, yahoo, youtube, apple in mozilla's folder,how to get it back like the first time i installed? thx

    if you hid the menu bar and the navigation bar simply press the alt button, this will bring back the menu bar and form there you can right click and select which bars you want shown

  • How to get Open Balance for the year and Total Ending Balance?

    For a given account, how to get Open Balance for the year (Cumulative Ending Balance) and Total Ending Balance (Cumulative Ending Balance)?
    Is there any function module available? or should I read from some tables? Please advice.

    Hello Paul,
    You could try calling one of the following BAPIs - see which one meets your requirement. They are documented well so shouldn't be a problem finding out the correct one for your requirements.
    BAPI_GL_GETGLACCBALANCE      
    BAPI_GL_GETGLACCCURRENTBALANCE
    BAPI_GL_ACC_GETBALANCE      
    BAPI_GL_ACC_GETCURRENTBALANCE
    BAPI_GL_ACC_GETPERIODBALANCES
    BAPI_COND_VAL_DECRE_BALANCES
    You might have to put in some of your own logic after the BAPI call to get what you want.
    Hope this helps,
    Cheers,
    Sougata.
    p.s. Also look at FM FAGL_GET_ACCOUNT_BALANCE
    Edited by: Sougata Chatterjee on May 7, 2008 11:47 AM

  • How to get a question in the course placed anywhere in the course and does not appear in the quiz result or total number of questions. Pretest would work except it can't go anywhere in the course (at least for me it can't)

    How to get a question in the course placed anywhere in the course and does not appear in the quiz result or total number of questions. Pretest would work except it can't go anywhere in the course (at least for me it can't)

    Use a normal question, and do not add the score to the total score. That will give you a correct score at the end. But the total number of questions, that system variable will still take into account all questions. You'll need a user variable, and calculate its value by subtracting 1 from the system variable cpQuizInfoTotalQuestionsPerProject. Same for the progress indicator if you want to show it?
    Customized Progress Indicator - Captivate blog
    If you want to allow Review, you'll have to tweak as well. You didn't specify the version, and all those questions I now mentioned.
    And my approach, since you talk about only one question: create a custom question, because you'll have total control then.

  • How to get boot camp in the emac

    how to get boot camp in the emac

    Furthermore, eMacs can only emulate the Windows environment, whereas Intel CPU Macs including the iMac you have running 10.6.8 can virtualize Windows.  Emulation is a poor man's solution, because software is used to replace functions that normally take place with hardware.  You can use the iMac to do any data conversion before it gets sent back to the eMac over a network.  See my FAQ* regarding Windows on the Mac:
    http://www.macmaps.com/macosxnative.html#WINTEL

  • Have a new PC desktop with 4 hard drives, new c, d and old c, d, My ipad library is in old c, how to get my itune open the right drive, it keeps on open in new c drive.

    Have a new PC desktop with 4 hard drives, new c, d and old c, d, My ipad library is in old c, how to get my itune open the right drive, it keeps on open in new c drive. It said my computer is not authorized. I want to move all the old c to the new c drive, or get the itune to open my old c drive when I log in.

    might be some help on one of these links.
    Windows - Change iPad default backup location
    http://apple-ipad-tablet-help.blogspot.com/2010/07/change-ipad-default-backup-lo cation.html
    Windows - Changing IPhone and iPad backup location
    http://goodstuff2share.wordpress.com/2011/05/22/changing-iphone-and-ipad-backup- location/
    Sync Your iOS Device with a New Computer Without Losing Data
    http://www.howtogeek.com/104298/sync-your-ios-device-with-a-new-computer-without -losing-data/
    Syncing to a "New" Computer or replacing a "crashed" Hard Drive
    https://discussions.apple.com/docs/DOC-3141
     Cheers, Tom

  • HT4889 Replacing System hard drive with a new one. How to get everything over to the new boot drive?

    Replacing System hard drive with a new one. How to get everything over to the new boot drive? Should I use Carbon Copy or does apple have a better untility to do this?
    I can't get my current system drive (OSX 10.8.3) to start on the first try. I always have to shut down and restart again to finally see the Apple logo.
    Have used disc utility to repair the disc and permissions several times and that works. The next time I boot up, it works fine and I get the apple logo, but then the second time I boot up, it's back to the blank screen again and it only boots after the second try.  I have tried this repair three different times now always with the same result. Works right the first try (after the repair) then from the second time on it doesn't work. I just get the white screen until I reboot a second time.
    Thinking I should change drives but what's the easist and best way to move everything over to the new drive so it will boot correctly with all my data on it. This is the system drive for a Pro Tools 10HD setup. MacPro 3,1 with 16 gigs ram and OSX10.8.3 on it.
    Thanks for any help!

    If you have a time machine back up of your current drive you can do this
    Shut down your computer, install the new drive. While the computer is off plug in the external hard drive that you have your time machine back up on. Hold Option key while the computer turnes on, let go of the option key once you get a grey screen. Shortly after you'll see  a list of bootable drives, select the one that has your time machine back up on it and boot into that drive.
    From there go into disk utility, format your new drive too, osx extended journaled ( I think, double check that, its been awhile since ive had to do this), hit format
    Exit disk utility and then you can use time machine to copy all your exisit data to the new hhd and then your pretty much done.
    There is also a program called Carbon Cloner that will do esentially the same thing however I've never uesed it.

Maybe you are looking for

  • Unable to locate timecode in batch capture

    Hi there, I have been working on this problem for a while and would really appreciate some help. I have a documentary project I have been working on for some time and have completed the EDL. I am now trying to batch capture the footage again in full

  • My safari doesn't seem to work well as before. Help me pleaseeeee! =]

    When i'm using safari, if i wan to go back to the previous page, i just have to slide with 2 fingers form the left to right.But if i do that now, the whole tab is useless. Anyone help me please?=]

  • Windows 7 install failed.How do I boot into mac?

    Hi, I tried to install windows 7 using the bootcamp assistant.I burnt the support software onto a separate disk but when I tried to install Windows 7 Ultimate 32 bit it asks me to load a CD/DVD driver.I cannot eject the Windows media for this driver?

  • How to edit external iPhoto Library pictures with an external editor?

    That's my question. I have my iPhoto Library on an external HD and I want to modify my pics with PSE 11. I've set my iPhoto prefs to do this but it just doesn't work. When I click on "edit with an externale editor" PSE 11 opens but doesn't show the p

  • Error while trying to expand the frame in oracle report...

    Hello I have standard report "Material Account Distribution Detail" in 11.5.10 in INV module and I want to customize the report which i want to add few more fields. Current width and height of the"Main Section" under Layout Model is 15 and 8.5. What