Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Jtable and JdatePickerCellEditor

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.-
 
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
German Schreiber
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
A wop bop a lu bop a womp bam boom! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!