• 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

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: 21997
107
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: 3204
29
  • 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.
    Bookmark Topic Watch Topic
  • New Topic