• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can I add extra field in my GUI?

 
FeiWen Cheng
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.I am designing my gui now on, and I have some problem in designing GUI.
Thanks for any suggestion!

My assignment is urlybird 1.3.2.

(Question 1)
In my assignment, there are 7 fields in each record(name,location,size,smoking,rate,date,owner).
I use the MVC pattern to implement my GUI. In order to keep previous selected data to be selected after refreshing data in the JTable. I have to use some filed to identify which field was selected before refreshing the JTable. I think each field in the record is improper to be a primer key, and it's improper to combine them to be a compound key. Therefore I want to add the recNo as the first column in the JTable. After add this column, I can easily to implement the function! Is it illegal to sun' rule?

(Note: recNo is a physical index of records in my db file)
-----------------------------------------------------------------
(Question2)
In my GUI. I have a JTextField to let user imput the customer(owner) ID. The length of customer ID is 8 characters. How to restrict user only key in customer ID with in 8 characters?

Thanks for you suggestion!
 
Steve Chaloner
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Consider using the record number and having it read-only, or present only in the model and not the view
2. Check out JFormattedTextField
 
dennis du
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
-----------------------------------------------------------------------
1. Consider using the record number and having it read-only, or present only in the model and not the view
----------------------------------
I had put the recNo to the JTABLE(view). I think it is legal to sun's request.
Is it right?
 
Steve Chaloner
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think it makes any difference since it will be generated by you anyway. If you're adding a function to navigate directly to a record by number then it's better to show it If you don't add this function, then it's of no use (that I can think of) to the user so it's better kept out of the view.
 
FeiWen Cheng
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Steve. I will try it!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic