I'm trying to get a TreeNode from my JTree.

Hi,
I'm trying to get a TreeNode from my JTree.
I have problems getting it.
I can get the selected object but it is not a TreeNode .
I need it because I need the node's children.
What I mean is - if I do the next :
TreePath treePath = tree.getSelectionPath();
Object o = treePath.getLastPathComponent();
if( o instanceof TreeNode ) {
System.out.println("YES");
else
System.out.println("NO");
I get the "NO".
Thank's,
Bnaya.

Try this code:
DefaultMutableTreeNode node =(DefaultMutableTreeNode)myTree().getLastSelectedPathComponent();
if (node == null) return;
Object nodeInfo = node.getUserObject();

Similar Messages

  • How to get a TreeNode from a JTree

    Hi,
    I'm trying to get a TreeNode from my JTree.
    I have problems getting it.
    I can get the selected object but it is not a TreeNode .
    I need it because I need the node's children.
    What I mean is - if I do the next :
    TreePath treePath = tree.getSelectionPath();
    Object o = treePath.getLastPathComponent();
    if( o instanceof TreeNode ) {
    System.out.println("YES");
    else
    System.out.println("NO");
    I get the "NO".
    Thank's,
    Bnaya.

    hi,
    Can u pls jus cast into TreeNode!!!
    Object o = (TreeNode)Treepath.getlastPathComponent();
    if()
    thank u ...
    Shalinipriya.
    }

  • TS1702 how do i delete from the startup disk? I am trying to get Mountain Lion from the App store and it says that the purchase was not complete because i need 4.06 GB space to download OS x 10.8. and to remove items from my startup disk to increase space

    how do i delete from the startup disk? I am trying to get Mountain Lion from the App store and it says that the purchase was not complete because i need 4.06 GB space to download OS x 10.8. and to remove items from my startup disk to increase space. How?
    Thanks

    You can use iCloud with 10.7.5. You do not need to upgrade to Yosemite. You should provide a minimum of 15 GBs of free space or 10% of the hard drive's capacity, whichever is greater.
    Freeing Up Space on The Hard Drive
      1. See Lion/Mountain Lion/Mavericks' Storage Display.
      2. You can remove data from your Home folder except for the /Home/Library/ folder.
      3. Visit The XLab FAQs and read the FAQ on freeing up space on your hard drive.
      4. Also see Freeing space on your Mac OS X startup disk.
      5. See Where did my Disk Space go?.
      6. See The Storage Display.
    You must Empty the Trash in order to recover the space they occupied on the hard drive.
    You should consider replacing the drive with a larger one. Check out OWC for drives, tutorials, and toolkits.
    Try using OmniDiskSweeper 1.8 or GrandPerspective to search your drive for large files and where they are located.

  • I'm trying to get a song from iTunes to Windows Movie Maker

    I'm trying to get a song from my iTunes library to Windows Movie Maker so I can use it in a video. I've tried importing it, copying it and pasting it, and clicking and dragging it, but each time, it says that it could not be impoted... Does anyone know how I can fix this?

    What file format is the song in, Lauen?
    To check, right-click on the song and select Get info. In the Summary tab, what is it saying next to "Kind"?

  • HT201269 i am trying to get my contacts from an old iphone 3s to a 5c and i am not getting the new phone to stay connected to itunes. some help please on what to do!

    i am trying to get my contacts from an old iphone 3s to a new 5c and i am not getting the new phone to stay connedted to itunes. some help please on  this problem!!!

    One way is to Drag and Drop the  Entire iTunes Folder  from your Old Computer to an External Hard Drive...
    Then Drag and Drop the  Entire iTunes Folder to the location of your Music on the New Computer...
    These Links may Help...
    Backup iTunes to an External Drive
    http://support.apple.com/kb/HT1751
    Moving iTunes Media Folder
    http://support.apple.com/kb/HT1364
    Cheers

  • Trying to get my photos from my 4s to a netbook

    hi
    trying to get my photos from my 4s - when i connect it to a windows 7 netbook i don't get the option to copy them - help =]
    device driver software was not successfully installed - is the error message when it connects but it seams to sync in itunes?
    anyone know how i can get my photos onto the netbook with out using the cloud?
    d d w

    Do you have a Passcode Lock enabled on your iPhone? Unlock your iPhone first and then connect it to your PC. Do the results change?

  • Trying to get my photos from iCloud restored. Just showing a grey box just now even for video.

    Trying to get my photos from iCloud restored. Just showing a grey box just now even for video.

    Gdkop wrote:
    Trying to get my photos from iCloud restored.
    How are you trying?
    Just showing a grey box just now even for video.
    Videos do not go into Photo Stream.
    You can add them to a Shared Photo Stream.

  • I've preordered my iPhone 5 from apple and tried to get a sim from o2, they said I couldn't preorder. Does anyone have any information about this?

    I've preordered my iPhone 5 from apple and tried to get a sim from o2, they said I couldn't preorder. Does anyone have any information about this?

    Ethmoid,
    Generally buying on contract or buying outright from apple with a separate sim from a provider is little difference in cost.
    Work out the total cost over 24 months for the phone+monthly tarrif and you will see.
    Also the contracts where the phone is cheapest but have a higher monthly cost tend to be the ones that cost you move over a 24 month period.
    For example;
    Using O2 UK as an example (other carriers are very similar). For the iPhone 5 64GB;
    From Apple £699, plus O2 On & On £20 per month is £1179
    From O2, Phone £249, per month, £41. Total over 24 months is £1,233
    From O2, Phone £169, per month, £46. Total over 24 months is £1,273
    From O2, Phone £69.99, per month, £63. Total over 24 months is £1,581  <Cheapest phone, most expensive
    *These all use the same tarrif of unlimited talk,texts and 1GB data. The only difference is how much you want to pay upfront for the phone*
    Also worth noting is buying the phone from apple and the O2 tarrif is only a 12 month tarrif so you're not locked in for 24 months.
    As you can see, the cheaper the phone, the more the overall amount you pay.

  • HT1766 trying to get my memos from icloud

    im trying to restart my phone usin a icloud backup from two days ago. it doesnt seem to work even tho im selecting it when i restart my phone.

    Gdkop wrote:
    Trying to get my photos from iCloud restored.
    How are you trying?
    Just showing a grey box just now even for video.
    Videos do not go into Photo Stream.
    You can add them to a Shared Photo Stream.

  • Swing: when trying to get the values from a JTable inside an event handler

    Hi,
    I am trying to write a graphical interface to compute the Gauss Elimination procedure for solving linear systems. The class for computing the output of a linear system already works fine on console mode, but I am fighting a little bit to make it work with Swing.
    I put two buttons (plus labels) and a JTextField . The buttons have the following role:
    One of them gets the value from the JTextField and it will be used to the system dimension. The other should compute the solution. I also added a JTable so that the user can type the values in the screen.
    So whenever the user hits the button Dimensiona the program should retrieve the values from the table cells and pass them to a 2D Array. However, the program throws a NullPointerException when I try to
    do it. I have put the code for copying this Matrix inside a method and I call it from the inner class event handler.
    I would thank you very much for the help.
    Daniel V. Gomes
    here goes the code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import AdvanceMath.*;
    public class MathF2 extends JFrame {
    private JTextField ArrayOfFields[];
    private JTextField DimOfSis;
    private JButton Calcular;
    private JButton Ativar;
    private JLabel label1;
    private JLabel label2;
    private Container container;
    private int value;
    private JTable DataTable;
    private double[][] A;
    private double[] B;
    private boolean dimensionado = false;
    private boolean podecalc = false;
    public MathF2 (){
    super("Math Calcs");
    Container container = getContentPane();
    container.setLayout( new FlowLayout(FlowLayout.CENTER) );
    Calcular = new JButton("Resolver");
    Calcular.setEnabled(false);
    Ativar = new JButton("Dimensionar");
    label1 = new JLabel("Clique no bot�o para resolver o sistema.");
    label2 = new JLabel("Qual a ordem do sistema?");
    DimOfSis = new JTextField(4);
    DimOfSis.setText("0");
    JTable DataTable = new JTable(10,10);
    container.add(label2);
    container.add(DimOfSis);
    container.add(Ativar);
    container.add(label1);
    container.add(Calcular);
    container.add(DataTable);
    for ( int i = 0; i < 10 ; i ++ ){
    for ( int j = 0 ; j < 10 ; j++) {
    DataTable.setValueAt("0",i,j);
    myHandler handler = new myHandler();
    Calcular.addActionListener(handler);
    Ativar.addActionListener(handler);
    setSize( 500 , 500 );
    setVisible( true );
    public static void main ( String args[] ){
    MathF2 application = new MathF2();
    application.addWindowListener(
    new WindowAdapter(){
    public void windowClosing (WindowEvent event)
    System.exit( 0 );
    private class myHandler implements ActionListener {
    public void actionPerformed ( ActionEvent event ){
    if ( event.getSource()== Calcular ) {
    if ( event.getSource()== Ativar ) {
    //dimensiona a Matriz A
    if (dimensionado == false) {
    if (DimOfSis.getText()=="0") {
    value = 2;
    } else {
    value = Integer.parseInt(DimOfSis.getText());
    dimensionado = true;
    Ativar.setEnabled(false);
    System.out.println(value);
    } else {
    Ativar.setEnabled(false);
    Calcular.setEnabled(true);
    podecalc = true;
    try {
    InitValores( DataTable, value );
    } catch (Exception e) {
    System.out.println("Erro ao criar matriz" + e );
    private class myHandler2 implements ItemListener {
    public void itemStateChanged( ItemEvent event ){
    private void InitValores( JTable table, int n ) {
    A = new double[n][n];
    B = new double[n];
    javax.swing.table.TableModel model = table.getModel();
    for ( int i = 0 ; i < n ; i++ ){
    for (int j = 0 ; j < n ; j++ ){
    Object temp1 = model.getValueAt(i,j);
    String temp2 = String.valueOf(temp1);
    A[i][j] = Double.parseDouble(temp2);

    What I did is set up a :
    // This code will setup a listener for the table to handle a selection
    players.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    ListSelectionModel rowSM = players.getSelectionModel();
    rowSM.addListSelectionListener(new Delete_Player_row_Selection(this));
    //Class will take the event and call a method inside the Delete_Player object.
    class Delete_Player_row_Selection
    implements javax.swing.event.ListSelectionListener
    Delete_Player adaptee;
    Delete_Player_row_Selection (Delete_Player temp)
    adaptee = temp;
    public void valueChanged (ListSelectionEvent listSelectionEvent)
    adaptee.row_Selection(listSelectionEvent);
    in the row_Selection function
    if(ex.getValueIsAdjusting()) //To remove double selection
    return;
    ListSelectionModel lsm = (ListSelectionModel) ex.getSource();
    if(lsm.isSelectionEmpty())
    System.out.println("EMtpy");
    else
    int selected_row = lsm.getMinSelectionIndex();
    ResultSetTableModel model = (ResultSetTableModel) players.getModel();
    String name = (String) model.getValueAt(selected_row, 1);
    Integer id = (Integer) model.getValueAt(selected_row, 3);
    This is how I got info out of a table when the user selected it

  • HT1473 Had to "repair" Itunes today after error messages would not let me open. I can no longer sync my phone to computer without deleting all of the contect on my phone. I don't want to do that! I am trying to get the music from my Iphone to my Itunes li

    Little background:
    Went to open Itunes, error message told me I was missing files and I was unable to open. I deleted Itunes and re-downloaded and received same message. I then "repaired" Itunes from my "unistall/change" program menu. The error message then changed to being "unable to read my library of music." So I fixed that by following some other forum directions (Went to My Computer/Music/Itunes then dragged the most recent Itunes Library selection to my desktop, then opened the folder under music titled "Previous Itunes library" and moved that file into that folder. Thankfully that worked... sort of... I have some music in my library. None of the music from my super old Limewire library, or any recent music from my phone. All of which was in my library last night. Not to mention the HOURS of cd's I burned to Itunes over the entire weekend. Hundreds (at least) of songs are missing.
    So I attempted to sync my phone and was told it would delete all of the files in my phone to replace with files from my computer. Which is NOT what I want to happen. Trying to get music FROM my phone to my computer.
    Can someone please help me simply sync my phone to my computer? And then somehow get the music from my Limewire library to my Itunes library? I know I may not get the burned music back... But that sure would be amazing.
    I am at a loss. Apple won't help unless I pay them... So hopefully this looks familiar to someone!
    Thanks,
    Katie

    This happens if the file is no longer where iTunes expects to find it. Possible causes are that you or some third party tool has moved, renamed or deleted the file, or that the drive it lives on has had a change of drive letter. It is also possible that iTunes has changed from expecting the files to be in the pre-iTunes 9 layout to post-iTunes 9 layout,or vice-versa, and so is looking in slightly the wrong place.
    Select a track with an exclamation mark, use Ctrl-I to get info, then cancel when asked to try to locate the track. Look on the summary tab for the location that iTunes thinks the file should be. Now take a look around your hard drive(s). Hopefully you can locate the track in question. If a section of your library has simply been moved, or a drive letter has changed, it should be possible to reverse the actions.
    Alternatively, as long as you can find a location holding the missing files, then you should be able to use my FindTracks script to reconnect them to iTunes .
    tt2

  • Been trying to get new speed from 8 Meg since Febr...

    In December we received a letter stating our bt contract was running out, we phoned up to renew our contract, whilst talking with the sales person we also talked about our exchange that was being upgraded in February to 21CN WBC. They told us that renewing this contract would up us on the priority list for the new speed switch over.
    We are still waiting for our line to be changed to the new modulation, we have had numerous calls to bt asking what is going on and why we haven't been switched over yet, only to put through countless line tests and being asked to check our master sockets and filters.
    on Wednesday the 25 July 2012 it seemed like I made some progress speaking with someone who actually sounded like they knew what they where talking about over the telephone, they stated that our line would be switched from adsl max to adsl 2 and it would take 48 hours and then it would be done. It's now Sunday and our speeds and modulation are still exactly the same.
    Could some one please help it's been months of trying to get anywhere over the bt phone helplines.
    Here are my router stats
    ADSL Line Status
    Connection Information
    Line state:
    Connected
    Connection time:
    1 days, 02:46:31
    Downstream:
    7.938 Mbps
    Upstream:
    448 Kbps
    ADSL Settings
    VPI/VCI:
    0/38
    Type:
    PPPoA
    Modulation:
    G.992.1 Annex A
    Latency type:
    Fast
    Noise margin (Down/Up):
    10.2 dB / 29.0 dB
    Line attenuation (Down/Up):
    23.4 dB / 13.0 dB
    Output power (Down/Up):
    19.9 dBm / 11.8 dBm
    FEC Events (Down/Up):
    0 / 0
    CRC Events (Down/Up):
    0 / 0
    Loss of Framing (Local/Remote):
    0 / 0
    Loss of Signal (Local/Remote):
    0 / 0
    Loss of Power (Local/Remote):
    0 / 0
    HEC Events (Down/Up):
    0 / 0
    Error Seconds (Local/Remote):
    0 / 0
    Sam knows exchange link
    http://www.samknows.com/broadband/exchange/LCECC
    bt wholesale exchange link for speeds
    For Telephone Number  on Exchange ECCLESTON
    Your exchange is ADSL enabled, and our initial test on your line indicates that your line should be able to have an ADSL broadband service that provides a fixed line speed up to 2Mbps.
    Our test also indicates that your line currently supports an estimated ADSL Max broadband line speed of 8Mbps; typically the line speed would range between 7Mbps and 8Mbps.
    Our test also indicates that your line currently supports an estimated ADSL2+ broadband line speed of 13.5Mbps; typically the line speed would range between 11.5Mbps and 15.5Mbps. Our test also indicates that your line could support an estimated ADSL 2+ Annex-M broadband upstream line speed of 1Mbps and downstream line speed of 13.5Mbps; typically the downstream speed would range between 11.5Mbps and 15.5Mbps.
    The actual stable line speed supportable will be determined during the first 10 days of use. This speed may change over time, to ensure line stability is maintained.
    If you decide to place an order, a further test will be performed to confirm if your line is suitable for the service you wish to purchase.
    Thank you for your interest.
    Please note that postcode and address check results are indicative only. Most accurate results can be obtained from a telephone number check.
    Note: If you already have a Broadband service enabled on this line and you want to switch service providers, you will need to contact both your current provider and your new provider to get your service changed over new and existing service provider to have this service transferred.
    Solved!
    Go to Solution.

    After talking with the care team My conenction is now on the new adsl 2 speeds thanks to David. 
    The main reason We were after the new speeds was the new upload speed, it seems my download speed has been improved but my upload speed is still the same.
    Would I need to re contact the care team after the 10 days training period on the line training to see about getting the new upload speed also?
     ADSL Line Status
    Connection Information
    Line state:
    Connected
    Connection time:
    4 days, 09:58:30
    Downstream:
    16.99 Mbps
    Upstream:
    443.9 Kbps
    ADSL Settings
    VPI/VCI:
    0/38
    Type:
    PPPoA
    Modulation:
    G.992.5 Annex A
    Latency type:
    Fast
    Noise margin (Down/Up):
    5.4 dB / 28.1 dB
    Line attenuation (Down/Up):
    22.8 dB / 12.8 dB
    Output power (Down/Up):
    20.0 dBm / 12.1 dBm
    FEC Events (Down/Up):
    0 / 0
    CRC Events (Down/Up):
    22195 / 0
    Loss of Framing (Local/Remote):
    0 / 0
    Loss of Signal (Local/Remote):
    0 / 0
    Loss of Power (Local/Remote):
    0 / 0
    HEC Events (Down/Up):
    205523 / 0
    Error Seconds (Local/Remote):
    7840 / 21

  • Problem while trying to get meta data from entity in CRM 2011 using java

    Hi,
    I have been trying to get the meta data from entity. Below is the code what i have tried.                                 
    EntityFilters entfilter = new EntityFilters();
    EntityFilters_type0 eftypes [] = new EntityFilters_type0[]{EntityFilters_type0.Attributes};
    entfilter.setEntityFilters_type0(eftypes);
    EntityFiltersE entityFiltersE = new EntityFiltersE();
    entityFiltersE.setEntityFilters(entfilter);
    Boolean RAIP = new Boolean(true);
    OrganizationServiceStub.ParameterCollection parameterCollection = new OrganizationServiceStub.ParameterCollection();
    OrganizationServiceStub.KeyValuePairOfstringanyType entityFilters = new OrganizationServiceStub.KeyValuePairOfstringanyType();
    entityFilters.setKey("EntityFilters");
    entityFilters.setValue(entityFiltersE);
    OrganizationServiceStub.KeyValuePairOfstringanyType retAsIfPublished = new OrganizationServiceStub.KeyValuePairOfstringanyType();
    retAsIfPublished.setKey("RetrieveAsIfPublished");
    retAsIfPublished.setValue(RAIP);
    parameterCollection.addKeyValuePairOfstringanyType(entityFilters);
    parameterCollection.addKeyValuePairOfstringanyType(retAsIfPublished);
    OrganizationServiceStub.OrganizationRequest request=new OrganizationServiceStub.OrganizationRequest();
                request.setRequestName("RetrieveAllEntities");
                request.setParameters(parameterCollection);
                OrganizationServiceStub.Execute org_execute = new OrganizationServiceStub.Execute();
                org_execute.setRequest(request);
    ExecuteResponse resp  =  serviceStub.execute(org_execute);
    And getting the below error.
    [ERROR] The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter
    http://schemas.microsoft.com/xrm/2011/Contracts/Services:request. The InnerException
    message was 'Element value from namespace http://schemas.datacontract.org/2004/07/System.Collections.Generic cannot have child contents to be deserialized as an object. Please use XmlNode[] to deserialize this pattern of XML.'.  Please see
    InnerException for more details.
    Please help me if any one have an idea on this error.
    Thanks in advance.

    Hi
    Did you get this resolved ?

  • I just bought a hp laptop trying to get my itunes from my old computer can someone help me

    i am trying to get my itunes library i just bought a HP laptop and I cannot get it i plugged in my ipod but having issues

    Please use periods at the end of sentences, so that your writing is easier to understand... 
    Do you have access to your old computer with its iTunes library intact?  Ideally, you should transfer your complete iTunes folder from the old computer to the new computer.  Then, iTunes on the new computer will look like iTunes on the old computer, with all of your songs, playlists, etc.  If you can do it that way, please post back for more info.
    Otherwise, you will need to off-load song files from the iPod...

  • HT1473 my computer crashed and i have a new computer with new itunes, i am trying to get my music from my old iphone 4 into the library but as soon as i unplug the phone it no longer appears in the library

    my computer crashed so i have a new itunes and i am trying to put my music from my old phone into itunes, it doesnt transfer only shows up when my phone is plugged in?

    The iphone is not a backup/storage device.  The sync is one way - computer to iphone.  The exception is itunes purchases:  File>Devices>Transfer Purchases
    You shouldcopy everything from your backup copy of your old computer, to your new one.  This one of the main reasons it has laways been very basic to always maintain a abckup copy of your computer.

Maybe you are looking for

  • Script no longer sends mail since upgrade to 10.5

    I used the script below to generate mail messages. Under 10.4 it would just send the message, now under 10.5 it puts it in the *Out Box* and that is it. Anybody knows how to fix this so it sends it immediately? set theBody to "abc" set theSubject to

  • Can't control the volume of speakers on external monitor using volume buttons on macbook keyboard

    The problem is exactly like this http://support.apple.com/kb/TS3520 except the update is for an older operating system, (I'm using lion). I can't find a solution that works for lion. I am using a non-apple monitor connected by a thunderbolt to hdmi c

  • MacBook won't load past the white startup screen.

    I'm going to start off by saying I'm a huge idiot. My MacBook was being sluggish last night, so I (impatiently) force-turned it off. Whenever I turn it back on, I get stuck at the white screen for about 10 minutes and the Apple logo never loads. I mu

  • Locating EJB classes from JSP

    Hi all, I have some JSP that invoke Session Beans. My question is: what is the right place to put EJB classes in order to be found by JSP ? I have found the following solutions but they both slow down during development phase: 1) Build an EAR and let

  • Combo box properties

    I have a form with a combo box.  What I want the combo box to do is to allow the user to select a value from Table A Field A and put the value from Table A Field B into Table B Field A.  I have made various changes to the properties for the Combo box