This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
I'm making a gui of the kind in which i want to display the textfield's content into the panel below it as soon as the button "ADD" is pressed.But i'm not able to do this .I've tried out all the possibilities i could think but, no results. What's happening in the code below is that when the frame is getting maximised the contents of the tree are getting displayed.But i need the simultaneous display of the contents in the textfield into the panel below it.SO,if anybody can help me sort out this problem,I'will be thankful to him.
Please use code tags. You can add them to your post by using the edit button at the upper right of it. Thanks!
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
The first problem I see is that you are adding your text from you JTextField to an ArrayList and then as you loop over the collection you create a tree for every single entry in the ArrayList. However, you never do anything with the actual text from the textfield beyond passing it to the tree(String s) method. I don't think you meant to perform this logic.
That aside, if you add panel2.validate(); just below your call to the show() method in your ActionListener, the JTree will show up after you click the Add button.