Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Dynamic component adding and removing to or from panes  RSS feed

 
Bugra Cakir
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a top level container pane and two child panes that have additional components
like JTable, JTextArea. I want to add one of JTable and JTextArea while some
condition is hold. For example user give an sql statement and execute it and
what i want is when an error occurs JTextArea must be added and when
everything is fine JTable is populated and inserted into the pane. But I can't
do that. Are there any examples that implemented this ? Thanx
 
Jon Dornback
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you have references to your table and text area, then you have at least a couple options:
1) if they are both in set positions in the top level container, you can call their setVisible(boolean) methods and make them appear or disappear as necessary.
2) call the add(Component) and remove(Component) method of your top level container if you want them to be taken out entirely and then added back in.
in either case, you'll have to update your table or text area with the appropriate data or error, and then update the GUI to show the changes.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!