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 7740217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:43:16+00:00 2026-06-01T08:43:16+00:00

In my implementation of JTable . I have to keep some columns editable and

  • 0

In my implementation of JTable. I have to keep some columns editable and some columns UN-editable so I have override isCellEditable –

@Override
public boolean isCellEditable(int row, int col) {
    if (col == uneditableColumn) {
        return false;
    }
    return bEdit;
}

Now my requirement is to allow edit the cell only on Double click i.e. if user double clicks on cell then only it comes into editable mode. For this – I will have to make your own CellEditor and override.

public boolean isCellEditable( EventObject e )

Can someone suggest if can be possible using –

public boolean isCellEditable(int row, int col) 

Please help –

  • 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-06-01T08:43:17+00:00Added an answer on June 1, 2026 at 8:43 am
    is to allow edit the cell only on Double click i.e. if user double clicks 
    on cell then only it comes into editable mode.
    

    you have look at DefaultCellEditor#clickCountToStart

    for CellEditor or methods override isCellEditable (AbstractTableModel)

    @Override
    public boolean isCellEditable(EventObject anEvent) {
        if (anEvent instanceof MouseEvent) {
            return ((MouseEvent) anEvent).getClickCount() >= clickCountToStart;
        }
        return true;
    }
    

    for DefaultTableModel could it be

    import javax.swing.*;
    import javax.swing.UIManager.LookAndFeelInfo;
    import javax.swing.UnsupportedLookAndFeelException;
    import javax.swing.table.*;
    
    public class EditorRendererClickCountToStart {
    
        public EditorRendererClickCountToStart() {
            TableModel model = new DefaultTableModel(new Object[][]{
                        {"A", "Item 0"}, {"B", "Item 1"}, {"C", "Item 2"},
                        {"D", "Item 3"}, {"E", "Item 4"}}, new String[]{"TextField", "Combo"});
            JTable table = new JTable(model);
            table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
            DefaultCellEditor editor = new DefaultCellEditor(new JComboBox(new Object[]{
                        "Item 0", "Item 1", "Item 2", "Item 3", "Item 4"}));
            editor.setClickCountToStart(2);
            table.getColumnModel().getColumn(1).setCellEditor(editor);
            table.setPreferredScrollableViewportSize(table.getPreferredSize());
            JFrame frame = new JFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.add(new JScrollPane(table));
            frame.pack();
            frame.setVisible(true);
        }
    
        public static void main(String[] args) {
            try {
                for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
                    System.out.println(info.getName());
                    if ("Nimbus".equals(info.getName())) {
                        UIManager.setLookAndFeel(info.getClassName());
                        break;
                    }
                }
            } catch (UnsupportedLookAndFeelException e) {// handle exception
            } catch (ClassNotFoundException e) {// handle exception
            } catch (InstantiationException e) {// handle exception
            } catch (IllegalAccessException e) {// handle exception
            }
            SwingUtilities.invokeLater(new Runnable() {
    
                @Override
                public void run() {
                    new EditorRendererClickCountToStart();
                }
            });
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to have some exemple of implementation of jXSearchPanel with jTable. I
I have a JTable (extended) and an implementation of TableModel , in which I
I have seen some implementation as follows: let rec fact = fun n ->
I'm trying to render an specific row of my jtable (it should have a
I have following implementation public abstract class BaseAcion extends ActionSupport { private String result;
The implementation used where I work uses about 10 columns in the table: CUSTOMFIELD1,
.Net's implementation of HTTP is ... problematic. Beyond some issues in compliance with HTTP/1.0,
The implementation is through a linked list. Would something like this be legal? int
All implementation of IHttpModule I've seen looks following: class HttpCompressionModule : IHttpModule { public
I am trying to create a JTable that has a row header that looks

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.