Questions tagged [jtable]

JTable is a Java Swing component used to display and edit regular two-dimensional tables of cells.

JTable is a Java Swing component used to display and edit regular two-dimensional tables of cells.

JTable is used to display and edit regular two-dimensional tables of cells. See The Java Tutorial: How to Use Tables for task-oriented documentation and examples of using JTable.

Reference: Class JTable

8514 questions
2
votes
6 answers

implement AbstractTableModel for a Java collection

I'm trying to implement an AbstractTableModel for a collection named "clients" but I keep receiving the error "required variable found value" for the "add" method. Here is my code: I'm sorry for the confusion created. The add method is meant to add…
bluesony
  • 459
  • 1
  • 5
  • 28
2
votes
1 answer

How can I make my JTable/TableModel dynamic?

So I'm in a situation where I want to use a JTable that can grow and shrink as per user input. (sort of like how an ArrayList can do that while a regular array can't). But I can't find any AbstractTableModel classes that can do this. Here is an…
u3l
  • 3,342
  • 4
  • 34
  • 51
2
votes
3 answers

Adding Row to JTable with "Real-Time Feeling"

I'm trying to make "Realtime Feeling JTable". I made GUI with JTable, and then there is a button named START. When I click this button, the program will call below start() method. (It's just an example). Adding row is no problem, It works well. But…
ton1
  • 7,238
  • 18
  • 71
  • 126
2
votes
3 answers

jTable Conditional show\hide edit and delete buttons based on owner of data

Im using jTable to display CDs info and a child table to show reviews of that CD. I want to be able to only show the edit\delete buttons on the rows for the user that is logged in. I have been trying to follow the suggestions made on:…
ToniHopkins
  • 369
  • 3
  • 11
  • 30
2
votes
2 answers

How can i add an UndoableEditListener to JTable cells?

Can i add an UndoableEditListener to a JTable? For example with a JTextField we do this : textField = new JTextField(); Document doc = textField.getDocument(); doc.addUndoableEditListener(new MyUndoableEditListener());
blackbishop
  • 30,945
  • 11
  • 55
  • 76
2
votes
2 answers

How to give JTable cell selection background and foreground color in table cell editor

I found the code to select a specific column on click of a JTable header. For my module, if someone selects a JTable cell all the previous column selection must be erased. I sucessfully change table.setColumnSelectionAllowed(true); or…
user1709952
  • 169
  • 2
  • 7
  • 21
2
votes
3 answers

Can I add a button to a JTable column header?

I have a JTable where the first column in each row is a checkbox. The user can select and deselect individual columns. I've got this working. Now I'd like to add to the column header a checkbox which can be used to "select all" and "deselect all".…
Steve McLeod
  • 51,737
  • 47
  • 128
  • 184
2
votes
2 answers

Need help creating an array

I need some help getting started. I have one array storing several arrays (in this case, lets say 3, this may be a lot more or less): mainarray {arr, arr, arr} All the arrays within the mainarray have the same amount of values, but this may also…
Mr.Turtle
  • 2,950
  • 6
  • 28
  • 46
2
votes
2 answers

How to edit JDateChooser table cell with keyboard

In my Java panel I have a JTable in which two of the columns use the JDateChooser object, from the package com.toedter.calendar, via a custom cell editor. Unlike cells that use text boxes or other simple components, which you can type into without…
Kevin M.
  • 21
  • 3
2
votes
2 answers

Displaying row numbers in JTable

hi I have this jtable which I want to have its auto increment row header for the user to identify how many data does the table returned. I am actually getting the table model from result set and the data is not fixed. It vary depends on the search…
miles
  • 225
  • 3
  • 10
  • 20
2
votes
1 answer

Add cellpadding to a Java JTable

I'm trying to implement a Swing JTable. I followed the tuorial on http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#simple I want the table cell's not to be editable (this works) and I want the table cells to have more padding to…
ToFi
  • 1,167
  • 17
  • 29
2
votes
2 answers

I cannot sort columns

I've a grid ,but I want only 2 columns with option to sort, as I do that? RowSorter newSorter = new TableRowSorter(table.getModel()); newSorter.setSortKeys(sortKeys); table.setRowSorter(newSorter); I used this
Esley
  • 25
  • 4
2
votes
1 answer

Return the focus to JComboBox inside a JTable after showOptionDialog

I'm having problems with a JComboBox used as a CellEditor for a JTable. I want after editing the JComboBox and pressing tab to show an OptionsDialog and, if a specific option is selected, the focus to remain on the JComboBox. The problem is that the…
Alex Burdusel
  • 3,015
  • 5
  • 38
  • 49
2
votes
1 answer

mouse event when mouse is getting out of JTable?

I use JTable, and have a MouseMotionAdapter listens to the mouse, and coloring the line of the mouse at any given moment. addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent e) …
user1028741
  • 2,745
  • 6
  • 34
  • 68
2
votes
1 answer

How to update jtable cell and TableModel programmatically?

I need to ensure that only one checkbox in column is selected. So, when user selects checkbox I must unselect previous selected. I tried to do it in setValueAt method of TableModel but I cannot update cell, even that one which I click by button. I…
Volodymyr Levytskyi
  • 3,364
  • 9
  • 46
  • 83
1 2 3
99
100