Forums Register Login

Jtable and JdatePickerCellEditor

+Pie Number of slices to send: Send
Hello everyone, i'm making a visual class, wich have a Jtable, in wich i would like to display different kind of data, one of the columns will contain an object i created myself with an expiration date, with the corresponding methods, (setExpirationDate(boolean b), and hasExpired() - boolean), i already made the renderer wich shows on the cell a red tag with the legend "expired", if hasExpired return true, if it is on the last month before it expires, the renderer shows a yellow tag with the "near expiration" legend (it has the method wich return boolean if it is on the last month), and there is the green tag with the "in order".

Im using as cellEditor on this particular column the org.jdesktop.swingx.table.DatePickerCellEditor, when i execute the program it shows the datepicker, when i click the cell, but then i click on the day i want to choose, it passes null value, so i have an object with a null date, and the program start throwing exceptions. I want to know if i can get the selected date on the DatePickerCellEditor cell, then create the object on the setValue() method, with that date, for the specific column, on MyTableModel (wich extends AbstractTableModel). Is this what should be done? i'm getting the whole "Java idea" wrong? Any suggestion or ideas? .

Well i'm working on a small compilable program using my classes, as example so all of you can see what i'm doing, but it will take a while since i have to Chop a larger program, and change some variables names and comments since english is not my native languaje, and you wont understand most of the program.

Thank you in advance.

Germán.-
+Pie Number of slices to send: Send
Hi,
Welcome to the Ranch!

Yes, posting a smaller program will be of larger help to us - we can then try and run the program and find out the issue. In fact, it can even help you to focus solely on the problem. (this is also called SSCCE).
+Pie Number of slices to send: Send
Well ofcourse... after i made this, small example it does work properly, now i have to check whats wrong on the original program. Here is the SSCCE working as i wanted.... hope it works as guide for someone else.


Back to make the original project work
+Pie Number of slices to send: Send
Well in fact i have a question. I want to know how can i make stop editing the cell and ecover the original date, when i click on other cell or click again the toggle button, without picking a value in the datepicker
Yup, yup, yup. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2421 times.
Similar Threads
JTable row and cell selection
problem in JTable
JTable selected row problem
disabling rows in JTable
Color in JTable
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 23:38:40.