Accesing to the jscrollpane from its jviewport.

Hi all:
I have a some JTables in some the JViewports of some JScrollPanes.
The JTables have a mousePressed event handler added to them. This event produces an MouseEvent:
jTableN.addMouseListener(new java.awt.event.MouseAdapter()
public void mousePressed(MouseEvent e)
usin g e.getSource() I get the JTable by casting it to JTable.
Using ((JViewport)((JTable)e.getSource()).getParent()) I get the jviewport of the JScrollPane that contains the table.
What I really need is get the JScrollPane that contains the Jtable, so I use:
((JScrollPane)(((JViewport)((JTable)e.getSource()).getParent()).getParent())
but it throws an exception:
java.lang.ClassCastException: javax.swing.JViewport
it's like if the method getParent() of the JViewport were returning another JViewport.
Can please S.O. help me or give me any ideas?
What I really need it get the JScrollPane that contains the Jtable from the MouseEvent generated.
Any ideas are wellcomed.

OK, incredible but true...
You need to cast to times to JViewport to reach the jscrollpane:
((JScrollPane)((JViewport)((JViewport)((JTable)e.getSource()).getParent()).getParent()).getParent())
Thanks for your time.

Similar Messages

  • I have installed itunes 11.0.2.26. When I delete a file or podcast I am not being prompted to delete the file from its folder at the same time.

    I have installed itunes 11.0.2.26. When I delete a file or podcast I am not being prompted to delete the file from its folder at the same time. How do I restore this facility? I am running a 64bit Windows 7 OS

    Is the media files in question in the iTunes library or elsewhere on the computer?

  • When the PC System timing runs as per normal, reaches 0000hrs - a new date. How to Auto re-execute the VI from its first sequence order?

    When the PC System timing runs as per normal, reaches 0000hrs - a new date. How to Auto re-execute the VI from its first sequence order?

    Duplicate Post

  • How can I Call the MainVI from its SubVI, and this happen recursively?

    Hi All,
    How can I Call the MainVI from its SubVI, and this happen recursively?
    Actually, LAbView 7.1 doesn't support recurssion?
    Plz help me out!

    Dear GerdW,
    Thanks a lot 2 all of u guys,for all the brilliant responses.
    Actually, my basic aim is to call the Main VI, containing a SubVI.....
    Now, I want to call my main VI from this SubVI...recursively!!!!!..but whenever I tried to put the MainVI in this SubVI..an error message pops out saying recursive calling is not possible.
    I also tried using "Call by reference" but tht also didn't worked...an d error is somewat like...VI is invalid..or type matching..or state matching error.
    Here, Im attaching the snapshot of the MainVI... Im calling the SUBvi from it... It is running GOOD n FINE...
    But prob arrives when I call the Main from the SUBvi, which looks like same as MainVI(with little differences).
    I hope, Im clear in my words n not being ambigous.
    Plz, correct me where ever  im wrong.
    Thank You.
    Mishra_RnD
    Attachments:
    ScrShot.JPG ‏272 KB

  • I would like to know that my lightroom 5 has suddenly stopped working... whenever i am launching it it is showing that lightroom has ecncountered a problem in reading the photos from its cache..plzz help me to slove this problm... as soon as possible..

    it is shwing that it has ebcountered an eror from reading from its preview cache and needs to qiut...
    after re-instalation also it i still showing the same thing... plzz help me.

    That error message indicates that your preview cache files have become corrupt. This is not a critical problem to solve. Just delete the previews file it carries the same name as your catalog file with the extension ending "Previews.LRDATA" see the screen capture. Delete this file and when you next restart Lightroom it will rebuild the previews.
    The link below will let you know where the file is located.
    Preference and other file locations | Lightroom 4

  • My Blackberry Device got wet in Salt Water, How to extract the data from its Memory ?

    I have forgotten my device in my pocket while swimming in Sea Water. Eventually , the device got water damaged , I've taken out the battery, used the hair drier and still didn't work. All My concern is how can I retrieve the data on my Device Memory. Most important the Media Files (Photos, Videos...etc),
    Thanks,

    photos and vids ar most lilkely on the SD card and youcan get a USB reader to get them if they are not encrypted.
    Click here to Backup the data on your BlackBerry Device! It's important, and FREE!
    Click "Accept as Solution" if your problem is solved. To give thanks, click thumbs up
    Click to search the Knowledge Base at BTSC and click to Read The Fabulous Manuals
    BESAdmin's, please make a signature with your BES environment info.
    SIM Free BlackBerry Unlocking FAQ
    Follow me on Twitter @knottyrope
    Want to thank me? Buy my KnottyRope App here
    BES 12 and BES 5.0.4 with Exchange 2010 and SQL 2012 Hyper V

  • Deleted WLC from its folder under the Device work center of Cisco prime 1.2

    I kindly need  your help as regarding cisco prime infrastructure.
    I added the wireless LAN controller to the prime. I later had to troubleshoot the WLC because the reachability status showed UNREACHABLE.
    Due to my troubleshooting, I synched the WLC a couples of times and the collection status has been showing SYNCHING since then.
    I also tried deleting the WLC from its folder under device work center and it deleted but it still reflects under the ALL folder.
    Please would I have to wait for the SYNCHRONIZATION of the WLC to stop before I can completely delete it and re-add??
    Also I noticed that after deploying ''Interface Health'' under Monitoring Configurations, the CPU and memory utilization did not reflect for the devices cisco
    prime is managing.
    What have I missed out?
    Kindly help.

    Prime Infrastructure won't support those legacy models.

  • Once a movie is copied into iTunes, can I delete the file from the folder?

    I've copied several movies into iTunes and then sync'd them onto my Apple TV.
    My question is: Once I've copied a movie into iTunes, can I delete the movie from its original folder (e.g. the Movie folder) and still have the movie in my iTunes?
    More specifically, does "dragging and dropping" the movie into iTunes make a new copy of the movie file so that I can delete the original file? And if I can delete the original file, should I?
    MacBook Pro   Mac OS X (10.4.9)  

    Thanks. I'll check and see when I get home tonight. My guess is that that's the setting since my disk space has decreased a lot when I started copying things into iTunes.
    MacBook Pro Mac OS X (10.4.9)

  • Stop scroll bar in JScrollPane from updating viewport when dragging knob

    Hi,
    Does anyone know if it's possible to stop the JScrollPane from updating the viewport whilst dragging the knob of the scrollbar and only update once released.
    The problem I have is that the view of the scroll panes viewport is a JList that has an underlying model of a RandomAccessFile which can be very large. So when the user is dragging the scrollbars it will be accessing the file system to retrieve the relevant data for the JList.
    I've tried creating my own JScrollBar and adding a AdjustmentListener to ignore events whilst dragging:
    class MyAdjustmentListener implements AdjustmentListener {
    // This method is called whenever the value of a scrollbar is changed,
    // either by the user or programmatically.
    public void adjustmentValueChanged(AdjustmentEvent evt) {
    Adjustable source = evt.getAdjustable();
    // getValueIsAdjusting() returns true if the user is currently
    // dragging the scrollbar's knob and has not picked a final value
    if (evt.getValueIsAdjusting()) {
    // The user is dragging the knob
    return;
    Looking through the JScrollBar code it has a model that will fire adjustment events anyway, which I suppose are being picked up by the JScrollPane somewhere.
    I could use my own JScrollBar and not add it to the scroll pane and process the adjustment events myself and update the JList but I was wondering if there is a better way.
    Many Thanks,
    Martin.

    Two small changes seem to do the trick. You may want to test it thoroughly though ;)import javax.swing.BoundedRangeModel;
    import javax.swing.DefaultBoundedRangeModel;
    import javax.swing.JFrame;
    import javax.swing.JList;
    import javax.swing.JScrollBar;
    import javax.swing.JScrollPane;
    import javax.swing.SwingUtilities;
    public class OneStepScroller {
       public static void main(String[] args) {
          SwingUtilities.invokeLater(new Runnable() {
             @Override
             public void run() {
                new OneStepScroller().makeUI();
       public void makeUI() {
          Object[] data = new Object[200];
          for (int i = 0; i < data.length; i++) {
             data[i] = "Item Number " + i;
          JList list = new JList(data);
          JScrollPane scrollPane = new JScrollPane(list);
          BoundedRangeModel model = scrollPane.getVerticalScrollBar().getModel();
          final JScrollBar scrollBar = scrollPane.getVerticalScrollBar();
          scrollBar.setModel(new DefaultBoundedRangeModel(model.getValue(),
                model.getExtent(), model.getMinimum(), model.getMaximum()) {
             int oldValue;
             @Override
             public int getValue() {
                // changed here
                if (!getValueIsAdjusting() && !(oldValue == super.getValue())) {
                   oldValue = super.getValue();
                   // added this
                   fireStateChanged();
                return oldValue;
          JFrame frame = new JFrame("");
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setSize(400, 400);
          frame.setLocationRelativeTo(null);
          frame.add(scrollPane);
          frame.setVisible(true);
    }db

  • In iOS7 it writes from its own

    Sometimes my ipad mini which runs iOS 7.0.3 starts pressing random pieces of the screen from its own! 

    Hello panopan
    Start troubleshooting with the article below to help resolve the issue with the touchscreen on your iPad mini.
    iPhone, iPad, iPod touch: Troubleshooting touchscreen response
    http://support.apple.com/kb/ts1827
    Restart your device
    Hold the On/Off button until "slide to power off" appears. Slide to power off your device. When it is off, press the On/Off button to turn it back on. 
    If you can't restart your device, reset it by pressing and holding the Sleep/Wake button and the Home button at the same time for a least ten seconds, until the Apple logo appears.
    Clean the screen with a soft, slightly damp, lint-free cloth.
    Avoid using the device while wearing gloves, with wet hands, or immediately after applying hand lotion.
    If you have a protective case, or if you are using a plastic sheet or film on the display, try removing them and testing the device without it.
    If the steps above don't resolve your issue, please schedule a service appointment with an Apple Retail Store for evaluation. If an Apple Retail store is not an option, contact Apple to find out your best service option or see the Service FAQ for your product.
    Regards,
    -Norm G.

  • JScrollPane does its job until I minimize the GUI...

    Im adding a JScrollPane onto a JTextArea which works fine and scrolls vertically when there are multiple lines of text. However, when I minimize the GUI, or switch from the current page to another (using some radio buttons), the ScrollPane isnt doing its job as the whole GUI container kind of 'stretches' to accomodate the multiple lines of text. Hope Im making sense!
    Im using TableLayout to add the JTextArea to another JPanel and the JScrollPane to that JPanel and onto the JTextArea, as shown below:
    panel7.add(dNameInvoiceAddressField, "0, 14, 1, 16, f, b");
    panel7.add(new JScrollPane(dNameInvoiceAddressField), "0, 14, 1, 16");
    Any help greatly appreciated.
    Thanks

    any ideas...?

  • [b]HOW TO:[/b]  Copy and Paste THE Filename AND its PATH from Finder

    HOW TO DO THIS: Copy and Paste THE selected Filename AND its entire PATH from Finder to another application as in document footer reference, or document database which has a path field to aid in locating the file later.
    Finder, Spotlight and File Info (can be used to display Path) or using Command F, command I, etc. but user is not allowed to copy the path to clipboard.
    This is rudimentary, yet the word Path, is unknown to Mac Help.
    Message was edited by: jbov

    AJ,
    Isn't it amazing....There is no Command Key for this action? Apple Care was confounded too. And thanx, it'll be a help....
    Jim
    its tedious, but this should work:
    open a terminal window.
    Drag and drop the icon for the file in the terminal
    window.
    This will put the full path including the filename on
    the command line.
    Copy the path from the command line, and paste
    (wherever).
    Close the terminal window.

  • I have an IPhone with music on it and I have an iTunes account on my Mac book pro, its the same itunes account as my phone and it wont let me put music on my phone nor will it allow me to sync the music from my phone to the itunes on my computer. ?????

    I have an IPhone with music on it and I have an iTunes account on my Mac book pro, its the same itunes account as my phone and it wont let me put music on my phone nor will it allow me to sync the music from my phone to the itunes on my computer. Can you please help me out???? thanks

    If iPhone music is not on iTunes Library, you need a 3rd party tool to help you
    Mac: http://www.ecamm.com/mac/phoneview/
    PC: http://www.wideanglesoftware.com/touchcopy/index.php

  • I bought a ipod 4th gen and when i try login in with my apple id it says my security pin is wrong but its the 1 from the card help!!

    i bought a ipod 4th gen and when i try login in with my apple id it says my security pin is wrong but its the 1 from the card help!!

    Contact iTunes.  See the iTunes Store Account and Billing topic of:
    Apple - Support - iTunes

  • How to transfer file from ipod touch to i tunes. i have files in my ipod , ut itunes is  new so its telling if u sync the ipod all the files will be replaced but no files in the itunes.. so kindly help me how to transfer the files  from i pod to itunesb

    how to transfer file from ipod touch to i tunes. i have files in my ipod , ut itunes is  new so its telling if u sync the ipod all the files will be replaced but no files in the itunes.. so kindly help me how to transfer the files  from i pod to itunes......

    Some of the information below has subsequently appeared in a document by turingtest2: Recovering your iTunes library from your iPod or iOS device - https://discussions.apple.com/docs/DOC-3991
    Your i-device was not designed for unique storage of your media. It is not a backup device and media transfer was designed for you maintaining a master copy of your media on a computer which is itself properly backed up against loss. Syncing is one way, computer to device, updating the device content to the content on the computer, not updating or restoring content on a computer. The exception is iTunes Store purchased content.
    iTunes Store: Transferring purchases from your iOS device or iPod to a computer - http://support.apple.com/kb/HT1848 - only media purchased from iTunes Store
    For transferring other items from an i-device to a computer you will have to use third party commercial software. Examples (check the web for others; this is not an exhaustive listing, nor do I have any idea if they are any good):
    - Senuti - http://www.fadingred.com/senuti/
    - Phoneview - http://www.ecamm.com/mac/phoneview/
    - MusicRescue - http://www.kennettnet.co.uk/products/musicrescue/
    - Sharepod (free) - http://download.cnet.com/SharePod/3000-2141_4-10794489.html?tag=mncol;2 - Windows
    - Snowfox/iMedia - http://www.mac-videoconverter.com/imedia-transfer-mac.html - Mac & PC
    - iexplorer (free) - http://www.macroplant.com/iexplorer/ - Mac&PC
    - Yamipod (free) - http://www.yamipod.com/main/modules/downloads/ - PC, Linux, Mac [Still updated for use on newer devices? No edits to site since 2010.]
    - 2010 Post by Zevoneer: iPod media recovery options - https://discussions.apple.com/message/11624224 - this is an older post and many of the links are also for old posts, so bear this in mind when reading them.
    Syncing to a "New" Computer or replacing a "crashed" Hard Drive - https://discussions.apple.com/docs/DOC-3141 - dates from 2008 and some outdated information now.
    Copying Content from your iPod to your Computer - The Definitive Guide - http://www.ilounge.com/index.php/articles/comments/copying-music-from-ipod-to-co mputer/ - Information about use in disk mode pertains only to older model iPods.
    Get Your Music Off of Your iPod - http://howto.wired.com/wiki/Get_Your_Music_Off_of_Your_iPod - I am not sure but this may only work with some models and not newer Touch, iPhone, or iPad.
    Additional information here https://discussions.apple.com/message/18324797

Maybe you are looking for

  • Created Menu in JS in Acobat 7.0 that works and Don't work in 9.2

    I created a menu that does a "Save As" which converts pdf to jpeg in Acorbat 7.0 on XP Pro OS.  In MS VBA code, I do the following VBA Code that execute the menu in Acrobat using "MenuItemExecute".             Set gApp = CreateObject("AcroExch.App")

  • Add image to beginning of each cell?

    I'm using VB with Word Interop. Currently, the program is creating a Mailing Labels sheet for bottles. Is there a way to programmatically add an image to the beginning of each cell (before the New Recipe text)? Thanks!

  • Is there a way to move the blue indent rectangle without manually dragging it?

    I would like to be able to move the blue indent rectangle (located in the ruler, above the left blue triangle by default) without going up with my mouse and dragging it. Is there another way, perhaps a keyboard shortcut?

  • 10.5.3: No more preview window in iMovie '08

    It was fine until I installed the 10.5.3 update, now I have no preview of what I'm editing in iMovie '08, basically rendering the program useless. It can't be used if I can't see what I'm editing.

  • Viewing multiple calendars side by side, like in Outlook on PC

    Hi I have a client who has switched from PC's to Mac's. They used Outlook on the PC and grew up with the side by side calendar view (there are only 4 staff members). Do anyone know of a Calendar app for the Mac which will offer this? Thanks