*
The moose likes Swing / AWT / SWT and the fly likes Jtable and JdatePickerCellEditor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Jtable and JdatePickerCellEditor" Watch "Jtable and JdatePickerCellEditor" New topic
Author

Jtable and JdatePickerCellEditor

German Schreiber
Greenhorn

Joined: Sep 27, 2012
Posts: 3
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.-
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1076
    
  10

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).


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
German Schreiber
Greenhorn

Joined: Sep 27, 2012
Posts: 3
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
German Schreiber
Greenhorn

Joined: Sep 27, 2012
Posts: 3
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Jtable and JdatePickerCellEditor
 
Similar Threads
disabling rows in JTable
problem in JTable
JTable selected row problem
Color in JTable
JTable row and cell selection