Selection trouble with JTrees

Hi,
I have a JTree that launches an internal frame on selection of a node.
The problem is that after the selecion of a node, it can't be reselected unless you make another selection. This is very annoying as it launches unnecessary frames.
The TreeSelectionListener interface contains a single method, which is
valueChanged(TreeSelectionEvent),
called only when the selection changes.
Anyone know how I could enable the reselection of a selected node?
Thanks.

The API documentation for JTree has a section that starts like this:
"If you are interested in detecting either double-click events or when a user clicks on a node, regardless of whether or not it was selected, we recommend you do the following..."

Similar Messages

  • Trouble with JTree's and autmoatically expanding nodes

    I am writing an application which uses a JTree as a method of browsing through a certain structure (like a file system). I am having a little trouble though, with a number of small issues, which I am finding hard to get answers through searches (and have spent a fair while searching). In navigating the tree, I want to be able to automatically expand nodes.
    Firstly, I want the Root node to automatically be expanded. I cannot see ways of doing this. I have seen references to EXPANDED being set for the JTree constructor, but I cannot see any reference in the 1.6 API for this.
    Secondly, I want to be able to expand or hide the contents of nodes through other means than clicking on the icon to the left of a non-leaf-node. For example a button that would hide the contents of (i.e. close) the currently selected node. Code such as:
    myNode.setExpanded(true);
    myNode.setExpanded(false);and
    myNode.isExpanded();

    That's the ticket - again something I had seen, but had been using in the wrong way, but your suggestion has helped me get it right. I was trying to expand the path before any more nodes were added to the root node. Then nodes are added, and the application loaded with the root node collapsed. So now I have placed the call at the end of the recursive call to populate the tree.
    Thanks again.

  • A trouble with "LIKE" in a select statement

    Hi!
    I'm having trouble with "LIKE" in a select statement...
    With Access I can make the following and everything works well:
    SELECT name, birthday
    FROM client
    WHERE birthday LIKE '*/02/*';
    but if try to do it in my application (it uses Access), it doesn't work - I just can't understand that!!!
    In my application the "month" is always the currently month taken from the "System". Look what I'm doing...
    String query1 = "SELECT name, birthday " +
              "FROM client " +
              "WHERE birthday " +
              "LIKE '*/" +
              pMonth +
              "/*' " +
              "ORDER BY birthday ASC ";
    ResultSet rs = statement1.executeQuery(consulta1);
    boolean moreRecords = rs.next();
    The variable "moreRecords" is always "false", the query returns nothing although the table "client" has records that attend the query.
    Please, anyone can help me?! It's a little bit urgent.
    Thanks,
    Katia.

    Hi Katia,
    I'll bet the problem lies with the characters you're using to escape the LIKE clause. You're using the ones that Access likes to see, but that's not necessarily what's built into the JDBC-ODBC driver class.
    You can find out what the correct escape wildcard characters are from the java.sql.DatabaseMetaData.getSearchStringEscape() method. It'll tell you what to use in the LIKE clause.
    I'm not 100% sure about your code. It doesn't use query1 anywhere. I'd do this:
    String query = "SELECT name, birthday FROM client WHERE birthday LIKE ? ORDER BY birthday ASC";
    PreparedStatement statement = connection.createStatement(query);
    String escape = connection.getMetaData().getSearchStringEscape();
    String test = escape + '/' + pMonth + '/' + escape;
    statement.setString(1, test);
    ResultSet rs = statement.executeQuery();
    while (rs.hasNext())
    // load your data into a data structure to pass back.
    rs.close();
    statement.close();Let me know if that works. - MOD

  • Trouble with calculating fields. Can't select (check) fields. Also can't figure out what's wrong with a division field (percent) that I created. Keep getting the pop up that format of the field doesn't allow blah blah blah... Help!

    Trouble with calculating fields. Can't select (check) fields. Also can't figure out what's wrong with a division field (percent) that I created. Keep getting the pop up that format of the field doesn't allow blah blah blah... Help!

    1. Use the mouse to select the field and then press the space bar.
    2. A null string is the same as zero. What is the result for division by zero?

  • I M HAVING TROUBLE WITH MY ILLUSTRATOR. mY TEXT IS NOT GETTING SELECTED

    I M HAVING TROUBLE WITH MY ILLUSTRATOR. mY TEXT IS NOT GETTING SELECTED

    supd,
    By the sound of it, ti could be View>Show Edges or View>Show Bounding Box,
    or it could be locked object(s)/Layer(s),
    or the text could be hidden within a Clipping mask or something.
    Have you tried (Alt/Option) selecting with the Direct Selection Tool?
    Have you looked into the relevant expanded Layer(s) in the Layers palette?
    What happens if you Select>Object>Text Objects?

  • Since installing the new OS i am having troubles with different appliction icons showing up on my main page twice (upper left corner), and not allowng me to select certain ones (app store specifically).   Anyone else having this issue?

    Help - anyone else out there having trouble with the new OS system on their ipad 2?    I am not getting mutliple copies of several apps ont he main page.  They are "collecting: in a pike int he upper left corner and the original application icon is no lobger working.    I have tried a hard sync, and that didn't help.

    It should only be able to have one copy of an app on the iPad. Have you tried a reset : press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot.
    Do all the apps work ? In the past a few people have taken a screen shot of their iPad screen and that has then become their background picture - so some of the 'app's may actually be on your wallpaper picture and not actual apps. Have you tried changing the wallpaper to see if that makes any difference ?

  • Alternate Selection in a JTree

    I am doing a GUI application for a customer who wants support for
    Windows, Solaris, and Linux. The customer is strongly windows biased
    and insists on having alternate selection (right click) to them.
    The application is a 6 panel MDI GUI and they want consistent behavior in all panels. I can do it for 5 of them but am having some trouble figuring out how to do it for the sixth.
    The sixth panel is a JTabbedPane that contains any number of JTrees embedded one for one in a JScrollPane. I have the Swing and AWT books from SUN. I have been through everything to do with JTrees and TreeSelectionListeners in the books and at www.java.sun.com.
    I can't see any support for alternate selection (Unix style) or right-click in the selection listeners. I would sure hate to have to write my own Selection listeners, handling mouse clicks, and handling paths just to be able to tell when a customer wants to right click something in a directory hierarchy and be consistent with what he gets in a topology map.
    They point out that other competitive products (competitive to them) that use other development environments support this. I would appreciate any pointers to how to do this.

    OK, Does isPopupTrigger() supposed to be true for a button3 click in
    a MS window's environment? It isn't when I test it. When I use isMetaDown() it is true. When I check the modifier values it is true, but isPopupTrigger() returns false.
    The direction of my question is looking for somewhere in the selection logic for the JTree to put the over-ride for MouseClick. TreeSelectionListener is intuitively the place to put it. But so far I can find the correct place.
    The Java Swing Manual on page 1345-1347 shows an example of how to get access to the mouse event that initiates the selection. But using it produces some anomalous results. First, the isPopupTrigger doesnt work as advertised. Second, when you detect for isAltDown() and find it down and try to consume() the event to prevent default selection behavior, it doesn't work.
    I can get it to do the right thing in the MS Window's environment because the JTree ignores right mouse clicks so when I use them for PopUp selection (by using an OR of isAltDown() and isMetaDown() to avoid the bug in isPopupTrigger() ). However, when I test it using the left mouse button and the ALT Key, it still selects the object and adds it to the list of paths for the tree, even though I have issued a consume() on the mouse event. I strongly suspect that the JTree selection logic only looks at MouseButton1 and does not check to see if
    the altKey is down or not. That will create issues for a Unix platform.
    I am looking for the correct place to intercept the mouse clicks and either consume them or pass them on.

  • Trouble with OR in where clause

    Hello,
    I'm having trouble with execution speed. The problem seems to be with using OR in my where clause.
    Here's the meat of the function where i_pledge_number is an input parm:
    BEGIN
    SELECT /*+ INDEX (pp) */ SUM(pp.prim_pledge_amount)
    INTO return_amount
    FROM
    primary_pledge pp
    WHERE
    -- Get total if multiple allocations
    pp.prim_pledge_number IN
    (SELECT pc.pledge_number
    FROM pledge_codes pc
    WHERE pc.pledge_code_type = 'M'
    AND pc.pledge_code = 'AC'
    AND lpad(pc.pledge_comment,10,'0') = i_pledge_number)
    -- Get total if single allocation
    OR pp.prim_pledge_number = i_pledge_number;
    RETURN return_amount;
    END;
    If I comment out either half of the OR statement (either the subquery or the pp.prim_pledge_number = i_pledge_number half) the function returns a value in .02 seconds. If I leave the OR in, it takes 2.764 seconds to execute?? Can someone please show me a better way (faster) to do this? I tried using nvl() around the subquery but couldn't get it to compile.
    Thanks

    These things are difficult to diagnose remotely, but here is something you can try....
    SELECT */ SUM(pp.prim_pledge_amount)
    INTO return_amount
    FROM   primary_pledge pp
    WHERE  pp.prim_pledge_number IN (SELECT pc.pledge_number
                                     FROM pledge_codes pc
                                     WHERE pc.pledge_code_type = 'M'
                                     AND pc.pledge_code = 'AC'
                                     AND lpad(pc.pledge_comment,10,'0') = i_pledge_number
    UNION ALL
    SELECT i_pledge_number FROM dual)
       RETURN return_amount;
    END;If that doesn't do anything (and it might well not) there are a large number of different ways we can recast this query. To save us further guessing please give us more details: execution plans, database version number, volumetrics.
    Cheers, APC

  • (Trouble printing) Trouble with connection between Macbook Pro and Hp Deskjet 1510.

    Trouble with connection between Macbook Pro and Hp Deskjet 1510. (Nothing Prints).
    I have a Macbook Pro and am having difficulty printing documents from ‘Pages' from my Hp Deskjet 1510. I have installed the necessary software for the printer and it is connected via USB. Every time I try to print the printer icon comes up as it should, 'printing' and then 'job completed' and then the icon disappears. (Nothing is printed.) I thought it might be something to do with Pages compatibility with the printer but exporting the document to Word or making it a PDF doesn’t change anything. I don’t have Microsoft Word on my computer. The scanner does work and when I printed a ‘Test Page’ that worked too.
    Let me know if you know why this is happening.

    With these settings the network now works flawlessly, however, when i have my ethernet cable plugged in, my internet access via my airport card(on the macbook pro) is no longer available. Hoping you can tell me why this would be with this info i've provided.
    Educated guess. The networking devices have priorities as to which are used. The standard order is that Ethernet has a higher priority than Airport.
    While your Ethernet is unplugged it is inactive and the Mac ignores it. Once you plug it in, the Mac sees that it is active and switches traffic to that interface.
    I actually take advantage of this feature at home, but configuring my Airport and Ethernet with identical fixed IP addresses. Normally I'll use Airport, but if I'm copying a huge file and I want faster performance, I'll just walk my MacBook (previously iBook, previously Powerbook) over to my Ethernet switch and plug in my MacBook. Magically, the Mac detects that the Ethernet is active and continues the file transfer uninterrupted over the faster 100baseT Ethernet connection. When the transfer is finished, or if I really need to move back to the Comfy Chair, I unplug the Ethernet cable, and all activity reverts back to the Airport, all without disrupting any existing networking connections.
    You on the other hand have totally different settings for your Ethernet and your Airport, so when you switch to Ethernet, you basically loose your Airport connections.
    Something you can try:
    System Preferences -> Network
    Gear icon on the bottom left, next to the [+] [-] icons.
    Select *Set Service Order...*
    Now Drag the network interfaces into the perfer priority order you want. In this case put Airport above Ethernet.
    NOTE: You may want to create a new Network Location for this, instead of messing with your normal home Location (which is most likely the default Automatic. That way you have your original you can always fall back to.

  • Trouble with 3rd party VST installs for Garageband, can't find instruments

    Hi,
    I am having trouble with Audio Units for Garageband when installing 3rd party software, VSTs, loops, instruments. I have more issues with Logic Pro. I am hoping that it is the same underlying issue and that I am just missing something. I have the manuals (not great for troubleshooting). I am confused with some installs use User Library and others use the Computer Library. I do go to the mfgs sites for updates. The installs sometimes work as standalones but I don't see ALL of the components of the software in say Garageband or Logic. Mostly, I am missing the "instruments" and "loops" that I want to access within the DAW. Some examples:
    • Here is some of the software I am talking about:  East West sample libraries (Play and Native Instruments); Vienna Symphonic librarires; Sylenth1 (just last night); Sample Tank 2 and Total Workstation 2 from IK Multimedia and others.
    • In GB I see the Audio Units for Vienna, Play, Sylenth, some of the IK Multimedia but NOT any instruments when I go to the "Sound Generator" -- I seem to be missing the instruments and loops. I see less AUs in Logic Pro. Some of these are VST instruments.
    • Can I just drag-drop samples to the library folders to fix this?
    • The plug-ins do not seem to work (though Sylenth1 worked for a single sound). When there is a standalone app (as in Sample Tank), I finally got the "sounds" to be reinstalled and loaded, those sounds/samples don't show up in any DAW.
    • When and if the sounds/loops/samples show up in GB's "Instruments" section will I be able to tell that they belong to that particular software or library?
    Thanks in advance.
    John

    Found the answer myself, it was simple:
    • Select the Track
    • Show the Instrument (info area)
    • Click on Edit
    • Click on the "Sound Generator" pop up field.
    • At the bottom of the pop-up list, select from the Audio Units that you have installed. This is where you see "Sample Tank 2, Vienna Instruments..."
    • NEXT -- IMPORTANT:   CLICK ON THE PICTURE next to the Sound Generator pop-up field.The AU unit loads up, the interface pops up, you load up the instruments in this AU Unit. You do NOT see the sounds from the AU unit in the normal Apple instrument list.
    This was not intuitive but once you know it, fairly simple.
    Still, the devil is in the details -- more questions on the way.

  • IMessage trouble with two iPhones and one Apple ID

    Hi,
    I'm having trouble with iMessage after updating both of my iPhones to iOS 6 and not being able to use iMessage with one of the phones.
    Some background:
    -I have two iPhones, one on AT&T in the U.S., and one on NTT DoCoMo in Japan, both with separate phone numbers, using the same Apple ID.
    -The AT&T iPhone is a 4, the NTT is an unlocked 4S.
    On my 4 (AT&T), on iMessage, I have the option to send/receive as my U.S. phone number and my Apple ID. Works just like before updating.
    On my 4S (NTT), on iMessage, before I updated, I was able to send/receive using my Japanese number and Apple ID. After updating, I have the option to send/receive using my U.S. number and Apple ID. My Japanese number is greyed out and I cannot select it. When I turn on iMessage, it says "Waiting for activation..." and does not do anything. Turning iMessage off and on, some times I get an error message staying that activation cannot be completed.
    I have rebooted the phone multiple times, turned on/off iMessage and FaceTime, turned the Set Date & Time Automatically option on/off, and reset Network settings several times. Nothing works; iMessage will not activate on my NTT 4S. Please help!

    Finally resolved this issue after months of off and on troubleshooting.
    I have no idea exactly which steps "fixed" the issue, but here's what I did. None of the basic troubleshooting steps that are on here worked for me, and this is including restoring both phones in iTunes as a "last resort" step that two Apple technical service representatives suggested.
    I found a post on here from user "tungddao" who suggested:
    "Turn on iMessage then make a phone call to : 011+445773142076
                 With Facetime & Siri: 011+447786205094"
    I called both numbers with my NTT 4S, and both numbers hung up right away. I also texted both numbers, and the FaceTime one went through, while the iMessage number did not. I then checked my SMS blocking settings with NTT. There were no blocks, but I reset the settings to "unblock all" anyway.
    I was able to activate iMessage and FaceTime with my Apple ID and my NTT phone number. Halfway there.
    I then turned on my ATT 4, and while I could send/receive using my Apple ID and NTT phone number, the ATT number was greyed out, which was the opposite of what had happened before, when I could use the ATT number, but not the NTT one. On my NTT 4S, I could select my ATT number, but it was stuck on "verifying" for days, and I knew it wouldn't go through.
    So, I signed out of my Apple ID on iMessage and FaceTime on my ATT 4, and turned both services off. I turned on data roaming, and turned off WiFi. *This step was key to activating both services, as they would not activate over WiFi for some reason.
    I turned on iMessage and FaceTime without signing in to my Apple ID just yet. They both activated successfully, and then I signed into my Apple ID on both services, and from then on, I can use both numbers and my Apple ID on both phones! Finally!
    These are my current options:
    Phone 1 (4S on NTT): Phone 1's #, Phone 2's #, Apple ID
    Phone 2 (4 on ATT, roaming here in Japan on Softbank): Phone 2's #, Phone 1's #, Apple ID
    Hope this helps someone out there, as this issue was real frustrating for me.

  • Trouble with my Apple ID on multiple devices

    I am having trouble with my Apple ID when downloading app updates.  I go to update my Apps, but the Apple ID for a seperate iPod, that I also sync with this computer, is what appears when the password is requested.  I checked the account in Settings > Store and it is the correct one.  But everytime I attempt to update my Apps, it has the iPod's Apple ID, which is my father's Apple ID. 
    In short, when I try to update an app on my iPhone, my Apple ID is not displayed, but my father's iPod Apple ID is displayed with a request for the password.  I am not sure what I am doing wrong, but I would appreciate your assistance. 

    Ok, so you want to remove data (contacts, bookmarks, calendar etc) from other users from your iCloud/Apple ID?
    If you want to use your ID for your family because it is the account everybody uses to buy stuff then you only need to ensure that your apple ID is set up in the store (settings-store) and then the users of each device and put their own apple ID in icloud/message/facetime/etc.
    To set up your device, in my opinion, it is best to back up to itunes, and then plug your new device into itunes and "set up as ..." and select the backup from your device.  This will import all your data/settings and your new device will be set up just like your old one.
    I am not certain about using the same payment method for more than one account. 

  • I have a trouble, with lion my finder doesn't work, i can't open any window

    i have a trouble, with lion my finder doesn't work, i can't open any window

    Hi there are various threads here for this issue
    this one being the most extensive
    https://discussions.apple.com/thread/3191263?start=0&tstart=0
    First step is re-start the finder
    1. Press command-option-esc simultaneously
    2. Select Finder
    3. Click on re-start
    Then according to the above link, several people tried different things.
    Try out what you find in above thread
    Cheers

  • Update of photoshop CC - trouble with NVIDIA Quadro 1000M display driver. PS freezes

    Hey guys,
    Since today I've got trouble with my PS CC.
    I've updated PS CC yesterday 2014-12-12.
    I was doing some drawings today and two times PS freezes during switching layers of or selecting a mask.
    A message appeared that there was trouble with the display driver an PS switched off the GPU support because of that issue.
    Ok, I thought let's update the display driver and so I've done today. I switched to actual NVIDIA display driver version 314.21
    I'm working with an NVIDIA Quadro 1000M on a DELL mobile Workstation Precision M4600 with 8 GB RAM.
    Now when I start up PS and press alt+k, my 2 displays showing a black screen for 1-2 seconds.
    After closing the general setup window again black screen for 1-2 sec and the top menu bar is showing no entries.
    When I move the mouse pointer over the bar, the menus appear again. But the bar is like transparent at the parts where no menues are.
    When I unlock the window from the screen an put it back fitting to the screen everything looks like normal.
    Till today I hadn't any problem with my notebook in that kind of way.
    Maybe someone has or had similar problems.
    Would be nice if someone can help me.
    thanks

    Oh, that sounds very bad. It's not that bad for me. It's not crashing that often at the moment, only black screens at start up or if setting dialog is opened. But I will see tomorrow how often it will crash, during today it crashed 2 times when doing some ridiculous simple actions like switchid to another layer  and the other time when trying to edit an mask layer. I will contact the support chat on monday regarding this issue. Maybe there is a solution or an update soon... I keep may fingers crossed for you.

  • Trouble with Mac Unexpectedly Quitting

    I have a iMac with the following hardware overview:
    Model Name: iMac
    Model Identifier: iMac7,1
    Processor Name: Intel Core 2 Duo
    Processor Speed: 2.4 GHz
    Number Of Processors: 1
    Total Number Of Cores: 2
    L2 Cache (per processor): 4 MB
    Memory: 2 GB
    Bus Speed: 800 MHz
    Boot ROM Version: IM71.007A.B03
    SMC Version: 1.20f4
    I have trouble with programs unexpectedly quitting and am having trouble finding out what's wrong. The most problems occur when using Photoshop Elements 4.0.1 (which happens multiple times daily, usually if not always when I'm trying to save), but I've also had Safari quit unexpectedly. I've been working with both Apple Care and the Adobe technical support and have found no solutions as of yet. Here are all of the things I've tried to date (and none have yet solved the problem):
    - Emptied Cache and Cookies folders
    - Run Repair Disk Permissions & Verify Disk
    - Re-installed Adobe Photoshop Elements
    - Created a new user account and tried running the program from within there
    - Booted up the computer in safe mode and run the program (still quit unexpectedly)
    Was being helped by Apple Care once again and they were going to have me re-install Max OS X, but the guy suggested I post here first for advice.
    I do have the option of upgrading to Max OS X Leopard, but didn't want to complicate things (although maybe they'd improve).
    Any advice would be greatly appreciated. Definitely not a tech wiz, but do understand a bit.
    Thanks for reading this...

    Welcome to the Forums
    Did you run Repair Disk from your Install Disc? Boot holding down the C Key
    From the Installer Menu select Utilities>Disk Utility>Repair Disk..Reboot
    Then..Applications>Utilities>Disk Utility>Repair Disk Permissions.

Maybe you are looking for

  • BPM alert not being generated

    Hi guys, I'm having quite a little trouble in doing one thing which has been done for several times but which is giving  me a hard time... I've created a bpm process which in an error condition will trigger a simple alert. I've tested the process and

  • IMac tv, can I set the imac up as a tv

    Any iMac tv help.

  • Multiple mail to vendor

    Hi All, Is there any way to output P.O as a mail to different vendor mail IDs?

  • Events management in iPhoto 2008.

    Dear members: After the upgrade to iPhoto 2008 with the new Events feature I noticed that the way the application organized the Events is less than ideal for my needs. I want to overide iPhoto and create my Events manually based on my own needs. Ques

  • How can I prevent spam with Safari?

    Sometimes I get some spam on my iPad 2 using Safari. How can I prevent this?