I have a properties file with a set of commands and their meanings
(Command = the meaning). I Populated a jtree with the keys from the properties file, now when I click a node in the jtree (key) I want the value of that selected key to go in the panel that sits in my app next to the jtree.I've tried everything to get it to work how I thought it would, I have never done this before and it's my first time posting here too!
Code tags: Don't know. I tried to correct your code tags but I don't think I did anything to them. They seem all right now, however.
I presume a lot of that code is automatically generated? I got rid of some of the excess blank lines. Never write an empty catch statement. Avoid comments like
//it will be visible
frame.setVisible(true); because you can work that out by reading the code. Also make sure your indentation is consistent: look at lines 50/51 and 135-156.
I think that code is too much for us to be able to take it apart. I think you should start with your properties file and print it out at the command line. Then create Property objects for each Property and print them to the command line with their toString() method.
Also some dseign problems, I think.
I don't like extending Swing classes. Better not to extend JFrame, but to have a frame as a field or better still local variable. That way you can have classes which implement the display and classes which implement the underlying logic. You have actually extended JFrame, but never used the framey parts of your class. Simply let it extend Object and you have got a frame already.
Avoid myFrame.getContentPane() if you can, because it is often unnecessary.
You can read about listeners for trees in the Java Tutorials; there appear to be four sections. Unfortunately at that point I find I have forgotten everything I ever knew about trees.
Thanks for all the help!I'll get those changes sorted out,yeah my code needed clearing up again,I managed to clean it up abit before posting it on here. I've only just recently gotten in to Java so I occasionally get a bit stuck and what not!
Does anyone have any idea what i can do with this then? I'm a tad confused as to how to retrieve a value from a key value pair when the key is clicked on still and display it in my panel I know it's probably wrong I just don't know where to go with it from here anymore
Also I made the changes suggested previously and cleared up my code a bit it looks a lot better now so thanks!