• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable problems

 
kevin chang
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1.if i want to make some columns in JTable uneditable, what method should i use?
2.i want to edit the JTable field, after that, i will press a JButton to save the result to the db.db , how to make that one field change? what method should i use?
 
xin dong
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
  • I think you need override the isCellEditable method in AbstractTableModel class
  • use setValueAt will work


  • [ March 29, 2003: Message edited by: xin dong ]
     
    kevin chang
    Ranch Hand
    Posts: 64
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I used to use setDataVector() method in DefaultTableModel to build the TableModel.
    If i extends an AbstractTableModel, and overridden the setValueAt() method , i even could fing the setDataVector() method, what can i do?
     
    kevin chang
    Ranch Hand
    Posts: 64
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Also , I have try to use new TableModel to extends the DefaultTableModel. fireTableCellUpdated(row, col) in the setValueAt(Object value, int row, int col) seems not affect display on the GUI.
     
    my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
    the new thread boost feature brings a LOT of attention to your favorite threads
    https://coderanch.com/t/674455/Thread-Boost-feature
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!