• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Change Text for JButton rendered in a JTable

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to change JButton text on mouse click, the JButton is rendered in a JTable.
JButton text gets changed for that JButton but it is not reflected in JTable..
Can any one tell where am i going wrong???


 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Can any one tell where am i going wrong???

to be honest with you, most people won't read more than a handful of lines (would you?)

if you have a problem, posting the code is great, but we have to be able to compile/run it,
to understand/see the problem.

these lines don't help.

import com.edex.MainApp.PageList;
import com.edex.controller.DefaultComboBoxController;
 
Sheriff
Posts: 21759
102
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, these two imports aren't used anymore, but removing them still leaves 5 compiler errors.

Shreyas, please turn your code into an SSCCE.
 
Rancher
Posts: 3051
22
  • Likes 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your concept of a renderer is wrong. A renderer is used to display the data found in the TableModel.

So your renderer needs to set the text of the button based on the data in the TableModel. If you want to change the text that is displayed on the button then you need to update the TableModel to the new text value. Then you tell the table to repaint that cell and your renderer will automatically pick up the new text from the model.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!