This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Here are the dependencies Madhav . 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 "Here are the dependencies Madhav ." Watch "Here are the dependencies Madhav ." New topic
Author

Here are the dependencies Madhav .

Meghna ks
Ranch Hand

Joined: Mar 15, 2001
Posts: 122
Hi
The dependencies are a set of other attributes :
Right now I have some Labels and Textfields ,
1. Label => Name, Textfield => Value
2. Now the Value attribute depends on attributes such as :
a. Syntax => String data type => eg : "Integer", "Date/Time", "String" etc.
b. Max Value => String data type => eg. "100"
c. Min Value => String data type => eg. "10"
Now, my question :
Depending on the string passed in syntax, the Value (textfield)should format itself to accept the respective datatypes.
i.e If
a. Syntax => "integer", Value => Integer i/p only
b. Syntax => "Date/Time", Value => format itself to accept Date/ Time only. For user i/p a calender should popup
c. Syntax => "IPAddress", Value => format itself to accept IPAddress only
I'm done with part (a). How do I go about doing part(b) and part(c) ?!!!
I hope I'm clear this time.
Thanks
Meghna

Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
Thanks Meghna. Interesting problem.
I have one question, When do I know abt the
Syntax String, before my form shows up or after,
I hit okay. I am assuming that its avail. before
I display the form/textfield. Can I assume this?
Pl. let me know.
regds.
- satya

Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Meghna ks
Ranch Hand

Joined: Mar 15, 2001
Posts: 122
Hi
Right now, I'm initialising(hard coding) syntax as "String", "Integer" and so on. So, this data is available before my form shows up. since I already know the data in syntax, I should format my Value field likewise i.e "Hello", "23" and so on. But if it is "Hello" then, it should accept only Strings and it goes on that way. Bottomline, the data in Syntax carries the datatype of the Value field.
Any inputs ?!!
Thanks
Meghna
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
a. Syntax => "integer", Value => Integer i/p only
b. Syntax => "Date/Time", Value => format itself to accept Date/ Time only. For user
i/p a calender should popup
c. Syntax => "IPAddress", Value => format itself to accept IPAddress only

One way I would think of is fillin the text fields with the
format you expect based on the syntax. then make the form
visible. After the user hits ok/submit, validate the response.
For Example:

This way the user will know what the system expects.
Hope you would agree that if we allow user to fill in
something and then validate it behind the scene and
popup error msgs, it isn't user friendly.
A second thought is because you already know what you
are expecting, beside the text field, specify a label.
Now set the text of this label based on the Syntax.
Also, I would change the COLOR of the label text to
be contrasting to the background (typically red) so
it grabs the attention of the user when s/he is
typing the input. This is a popular idea of saying
what to expect in the textfield. I have seen this in
many HTML forms for passwd's etc where they say
password should be 8 chars or more and
thing like that. So I think most users will already
be familiar with this kinda approach.
While I know little abt usability, these are my most
sincere suggestions.
HTH.
regds.
- satya
 
 
subject: Here are the dependencies Madhav .
 
Similar Threads
How to set the data type of an IPAddress & Date/Time
How to format a textfield to accept different data types?!!
how do I make a single cell of the second column to accept different data types ?!!
Hi guys !! I really need your help here ..
A Special TextEdit control for Date