• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Change Text for JButton rendered in a JTable

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 22862
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 3324
32
  • Likes 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic