Mike Lipay

Ranch Hand
+ Follow
since Sep 11, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mike Lipay

I'm sorry, mistyped, I did correct the code:




I was trying to answer questions that people were asking.
12 years ago

Rob Camick wrote:Well I give up, since you are obviously paying no attention to what I've said in this posting or others.

Why did you last reply include code for a Calendar object? This posting is about using the Date class not the Calendar class. The SSCCE you posted demonstrated your problem and you only need to change one line to fix it. Both Rob's have told you how to fix it.



Yes, I am paying attention, to several different conversations here. I changed GregorianCalendar to Date, after which I started receiving the deprecation error. Then I was told to see why, the API said to use Calendar because Date(int,int,int) was no longer supported. So I started explaining the problems I had using the Calendar class, i.e., the .set(int,int,int) method is returning errors, which is what sent me to GregorianCalendar to begin with.

I am paying attention to everyone here, and trying to answer and test what everyone suggests. And believe me, I am more confused than ever with trying to follow everything at the same time.
12 years ago
Sorry, but a lot of this just doesn't make sense. I see nowhere where I would get the idea that I have to use a mixture of Date and Calendar. From the Calendar API I would assume that this code should work:



Calendar() Constructs a Calendar with the default time zone and locale.
set(int year, int month, int date) Sets the values for the fields year, month, and date.

It doesn't.


12 years ago

Paul Clapham wrote:Okay. So what does that error message actually tell you about the Date class? And what does the API documentation recommend you should do instead?



It tells me that Date is on the way out, what I could find tells me to use Calendar instead. Tried that:



Tossed this error during compile:


According to the examples on java.sun.com what I coded was correct. Looking elsewhere for solutions is what led me to GregorianCalendar.
12 years ago

Paul Clapham wrote:The Date class isn't deprecated, so I expect your compiler error didn't really say that. Posting the actual error message also helps, whereas posting crude paraphrases of the error message is just distracting.



Here is the message:
12 years ago
I tried using the Date class first, but received a warning from the compiler about Date being deprecated. Is there a way around that other than using GregorianCalendar?
12 years ago
Ok, I didn't want to post the code if editing dates wasn't possible.

Ever other field in the table edits with no problem, and I can't see what I missed for the date.

12 years ago
Paul, thanks, using the super. worked.
12 years ago
Is there a way to allow a user to edit a date in a JTable? All of the columns I have in my table are open for editing, but when I click on the date column I cannot open it for editing. Is there something special that needs to be done for dates, or are dates not editable?
12 years ago
That's like another issue I'm having, and I've been real hesitant to post it. I searched for answers on how to capture a change in a cell, and all of the responses I've seen mention using setValueAt, no final code is posted and, in most cases, the thread just ends. Well, I tried that:



And, yes, I can capture the changes, but when the table initially displays all of its' contents are blank. Right number of rows and columns, but no data. Further searching showed suggesting adding



Well, that doesn't compile. Changing it to

compiles, but nothing is different. I figure others got it to work, but I'll be d--ned if I can figure out from the docs I've looked at on how it's done. Guess I'm just dumber than the others here, which makes me hesitant to even ask questions.
12 years ago
I don't know, before the code was:



When I change it to DefaultTableModel from AbstractTableModel it didn't work. The second change was small, but (at the time of this post) I thought perhaps there was something different between Default and Abastract. The new code worked, maybe I made other changes that messed things up.

12 years ago
Rob, you did give me an answer when I was working with an AbstractTableModel, but when I switched to the DefaultTableModel it no longer worked. Maybe it was the way I implemented your suggestion, not sure. That is why I asked again for the DTM, sorry if it was inappropriate.
12 years ago
Found my solution:




12 years ago
Using the DefaultTableModel, is there a way to align the contents in a cell? I have the following data (dollar amount, column 6) that I would prefer be right-aligned in the cell.


12 years ago

Seetharaman Venkatasamy wrote:better to say *array of arrays* insteadof multidimensional . your for loop declaration is wrong .




Sorry, multi-dimensional is how I've always seen nested arrays referred to. I'm guessing "array of arrays" is a java term. I'll try to remember this in the future.
12 years ago