Questions tagged [defaulttablemodel]

An implementation of the TableModel interface. Used (by default) by JTable to manage the data found in the table. Custom/alternative implementations of the TableModel interface may be provided.

370 questions
-1
votes
2 answers

ArrayIndexOutOfBound error when perform deletion in jTable

I try to select certain row from jTable and perform a deletion then the jTable will be updated with the latest data in database. This is how I set up jTable : private JTable getJTableManageReplies() { …
Newbies
  • 13
  • 5
-1
votes
1 answer

Existing posts keep on re-added into jTable with newer post

Here are my codes : public void submitReply(ActionEvent e) { String replyBy = userName; String reply = jTextArea_reply.getText(); if (reply.equals("")) { JOptionPane.showMessageDialog(null, "Comment cannot leave blank"); …
It newbie
  • 9
  • 4
-2
votes
2 answers

Jtable data retrieval problem in swing java

I want to retrieve data in jtable from MySQL database everything is right but the data present at index 1 are not shown plz loo image 1 and 2. jtable img 1: MySQL table img2: public void view_librarian() throws SQLException { …
-2
votes
1 answer

Adding an image to JTable Cell

I am wanting to dynamically add data to a JTable including an image. Here is my code: Main class String image = matchedSlots.get(i).getImagePath(); String title = matchedSlots.get(i).getTitle(); String director =…
batsta13
  • 549
  • 2
  • 12
  • 26
-2
votes
1 answer

Reading text file to jtable

I want to make a JTable where the text file is read line by line using 2d array for only row looping. How do I loop on row in the DefaultTableModel. here is my code: try{ BufferedReader br = new BufferedReader(new InputStreamReader(new…
user2104819
  • 21
  • 1
  • 1
-3
votes
2 answers

Preventing NullPointerException error on empty result set returned in JDBC

I need advice on how I can avoid java.lang.NullPointerException when dealing with JDBC result set which I put on Swing components such as JTable I have written a method which gets the result set encapsulated in an object from a DAO Implementation…
heisenberg
  • 1,784
  • 4
  • 33
  • 62
-3
votes
1 answer

How to re use the JTables

import java.io.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.table.DefaultTableModel; import java.awt.Color.*; import java.util.Date; import java.sql.*; import…
Umair7
  • 11
  • 7
-3
votes
1 answer

JTable and removeAll behavior

i've read the javadoc of removeAll() method, but i don't understand so well what will happen. I need to remove all data contained in myJtable, and adding new data. removeAll will remove only data inside table? that's how i've declared my…
giozh
  • 9,868
  • 30
  • 102
  • 183
-3
votes
2 answers

Remove 1 selected Row from JTable

I try for almost 2 hours to figure out how to remove and update 1 row from a JTable but somehow it wont work. I use the following code: DefaultTableModel modelTable = (DefaultTableModel) jTabelRooster.getModel(); modelTable.addRow(new…
user2445977
  • 1
  • 1
  • 2
  • 6
-5
votes
1 answer

inserting data into jtable from jtextfield

I found the following code: private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { DefaultTableModel tableModel = new DefaultTableModel(); JTable table = new JTable(); table.setModel(tableModel); int…
1 2 3
24
25