Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 959277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:59:56+00:00 2026-05-16T00:59:56+00:00

I am adding Jbutton to a table by extendibg AbstractCellEditor class. But on click

  • 0

I am adding Jbutton to a table by extendibg AbstractCellEditor class. But on click of button the text doesnt change from “Start” to “Stop” .here is the class i implemented

     public class ButtonEditor1 extends AbstractCellEditor implements     
      TableCellEditor,ActionListener,TableCellRenderer{

       JButton btnSTART =  new JButton("START");
        private JTable table ;

     public ButtonEditor1(JTable table){
    this.table = table;
    btnSTART.addActionListener(this);
    }
public Component getTableCellEditorComponent(JTable table, Object value,
        boolean isSelected, int row, int column) {

    return btnSTART;
}

public Object getCellEditorValue() {
    // TODO Auto-generated method stub

    return btnSTART;
}

public void actionPerformed(ActionEvent e) {
    int row = table.getSelectedRow();
    if(btnSTART.getText().equals("START")){
        if(row != -1){
            btnSTART.setText("STOP");
        }
    }else if(btnSTART.getText().equals("STOP")){

        if(row != -1){
            btnSTART.setText("START");
        }
    }
    fireEditingStopped();
}
public Component getTableCellRendererComponent(JTable table, Object value,
        boolean isSelected, boolean hasFocus, int row, int column) {
    return btnSTART;
}

}

what i am doing wrong .. I have a Model class which takes the column as JButton and have overriden the method setValueAt and getValueAt.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T00:59:57+00:00Added an answer on May 16, 2026 at 12:59 am

    A JTable uses renderers to display data. Once you click on the cell using the button as an editor, the button editor is invoked for a split second, then the cell is placed back in rendering mode. So if you want to change the text you change the value in the model.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Adding the row one by one in the button click.. (i tried but its
I'm adding a panel into an already shown JFrame on click of button. Now
Adding Exceptional Handling is a good practise, but I have a doubt, In our
Adding functionality to a class can be done by adding a method or by
Adding strings localization files in iPhone bundle is very simple and perfectly fine but
Adding member variables to a class certainly boosts the memory footprint of its instances
How does one go about adding JButton s among various other Swing GUI components
I'm adding and removing a JButton on MouseEnter and MouseExit respectively. This is working
Adding Multiple series to the ComboChart with different graph types is straightforward, but I
I am adding a heater JButton and a heater JSlider to each Tab that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.