This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Hi all, For booking, I update directly the field owner in the JTable. The problem is, that JTable gets the value of the editing cell only if the return key is pressed. To avoid this(the cell value should be taking immediately by pressing the button "Book")I wrote when the button is pressed following code: TableCellEditor defaultEditor =_table.getDefaultEditor(tableMode.getColumnClass(5)); defaultEditor.stopCellEditing(); The problem is that this is not working for the first time that I tried to update the owner field equal which row I selected. After this, it works on all records. Any ideas how I can correct this? Regards, Maria
Maria Lepschy
Ranch Hand
Joined: Jan 12, 2004
Posts: 78
posted
0
Ok, it works if I add a FocusListener on my table. But I changed my design and I entered the owner in a separate text field. Now I have another question. In my instructions stays about the owner: "The id value (an 8 digit number) of the customer who has booked this". That means that the owner length must be exactly 8, or? It should be possible to rebook one record? Regards, Maria
Originally posted by Maria Lepschy: Ok, it works if I add a FocusListener on my table. But I changed my design and I entered the owner in a separate text field. Now I have another question. In my instructions stays about the owner: "The id value (an 8 digit number) of the customer who has booked this". That means that the owner length must be exactly 8, or?
I understood in this way. It is an 8 digit number represented in text format(i.e. String). It can be between 1 to 8 digits and cannot be more than 8 digits.
It should be possible to rebook one record?
You can allow to rebook or not. If you do or don't you have to document it accordingly.
Hi Maria Have you considered while an user (User A) is booking for a room, another user (User B) is suceeded before User A? May I suggest you populate the JTable with the information from the database instead of using the value from the UI. Best Regards
Maria Lepschy
Ranch Hand
Joined: Jan 12, 2004
Posts: 78
posted
0
Hi Satish, Frankie, Thanks a lot. Satish, you mean the length of owner field can be less than 8? Frankie, I don'understand your answer very well. I populate my table from the database. I have only one screen with my table, the owner field and the 2 search criteria fields. If I want to book a record, I selected the row, fill the owner field. If I press book the value from the owner field is saved in the db file and is taken into the owner column from the selected row. So my table is always populated with the values from db file. Regards, Maria
Xie Ruchang
Ranch Hand
Joined: Dec 25, 2003
Posts: 160
posted
0
Hi Maria, Then it is OK, sorry that I have misread you. Best Regards,
Satish Avadhanam
Ranch Hand
Joined: Aug 12, 2003
Posts: 697
posted
0
Hi Maria,
Originally posted by Maria Lepschy: Hi Satish, Frankie, Thanks a lot. Satish, you mean the length of owner field can be less than 8?
Yes. But to make life easy, we can allow only 8 digit numbers in the owner field and document it as the requirement that owner field is EXACTLY 8 digits and not less or more So if the customer number is say 150, CSR MUST enter 00000150.
Frankie, I don'understand your answer very well. I populate my table from the database. I have only one screen with my table, the owner field and the 2 search criteria fields. If I want to book a record, I selected the row, fill the owner field. If I press book the value from the owner field is saved in the db file and is taken into the owner column from the selected row. So my table is always populated with the values from db file. Regards, Maria
Hope this helps.
Maria Lepschy
Ranch Hand
Joined: Jan 12, 2004
Posts: 78
posted
0
Hi Satish, Frankie Many thanks for your answer. Satish, this is a very good idea. Regards, Maria