Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Updating a JTable  RSS feed

 
Mousa A. Rafi
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having trouble updating a JTable. I've a JTable that's showing certain fields. But when I want to assign a new JTable there, the change isn't seen. In the following code, when the [bold]button is clicked, no change occurs. How can I achieve the desired behaviour?[/bold]

 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A gui is its own little world. Once you add a component to it, it (the gui) owns and manages the component. Pointing the reference to another component has no affect on the component previously added, it just means that you can no longer use the reference to get to the added component. To change components the technique is to first remove a component from the gui. Then you are free to add another in its place.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lightning Bug,

Welcome to Javaranch! We don't have too many rules around here but we do have a Naming Policy. Please read this and adjust your display name accordingly. You can change your display name by clicking [url=http://www.coderanch.com/forums/user/edit]here[url].

Thanks.
 
Mousa A. Rafi
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gregg Bolinger::
Sorry about not conforming with the policy. Actually I was not so much aware of the fact. The reason for not using my real name is that I wanted to avoid any sort of discrimination. Anyway I will change the name.

Craig Wood::
Thanks for your reply to the original thread. It was of a great help to me in programming with SWING and understand them better.

[ February 07, 2005: Message edited by: Lightning Bug ]
[ February 07, 2005: Message edited by: Lightning Bug ]
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Lightning Bug:
Gregg Bolinger::
Sorry about not conforming with the policy. Actually I was not so much aware of the fact. The reason for not using my real name is that I wanted to avoid any sort of discrimination. Anyway I will change the name.


No problem. We feel that Javaranch is a pretty friendly place and we have a host of different people from all over the world here but on the offchance you do feel discrimated against please notify me or another Bartender or Sheriff immediatly and we will take care of the situation ASAP.

Thanks and again, welcome to Javaranch!!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!