• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Swing GUI working not properly

 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

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.

THE CODE IS GIVEN BELOW:



[Added Code Tags - Gregg Bolinger]
[ February 08, 2005: Message edited by: Gregg Bolinger ]
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please use code tags. You can add them to your post by using the edit button at the upper right of it. Thanks!
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to the Swing forum...
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Jignesh Gohel
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot for the replies.
Jignesh
 
reply
    Bookmark Topic Watch Topic
  • New Topic