-
October 1st, 2008, 01:02 AM
#1
Pseudographics and arrays...
Hello!
So, quick and painless - what is Pseudographics?
Other thing - about programming principles - if I had to create a Java Applet and then require the user to enter a array of ten elements, would it be a good idea to have a TextField and let the user enter 10 items, seperated by commas. Then parse the field and fill in the array... or is there some more elegant way?
thanks!
-
October 1st, 2008, 08:07 AM
#2
Re: Pseudographics and arrays...
If you break the word into its two parts, you quickly get its meaning. Pseudo means fake. And I'm sure you know what graphics is.
Have you ever seen a picture, not drawn with vectors and rastered lines, but instead make with text and ascii characters? Then you know what pseudographics is.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
October 2nd, 2008, 01:34 AM
#3
Re: Pseudographics and arrays...
yeah, guessed already so.... a.k.a. ascii art; just wanted to make sure.
and what about the building-an-array-from-a-comma-delimited-string thing? I implemented that. The only problem is now to make some exception handling, which might turn out to be tricky as I have to check for so many things...
-
October 2nd, 2008, 04:30 AM
#4
Re: Pseudographics and arrays...
If by exception handling you mean validation of the text input then it is best done by looking for things you don't want people to do.
You might want to look up regular expressions, regular expressions are a good way to do quick validation on text and are very powerful.
Further, as part of a user interface, depending on what you want the array of items for, i would rarely if ever ask a user to enter a comma separated list. Number lists, yes. Anything else, no. A more elegant way is check boxes with multiple selects, etc. or if there are ten separate elements of information, name, dob, address etc. etc. then there is nothing wrong with 10 input boxes.
Note: Using check boxes for items you want users to enter also provides basic validation in that they can't enter anything you don't want them to.
What is the data you are handling, and in what context?
-
October 2nd, 2008, 05:13 AM
#5
Re: Pseudographics and arrays...
the data is a array of 10 characters. I put 2 checks on the string - check the count of characters in the string (it should be obviously==19) and check to see if there are 10 characters and 9 delimiters in the string. That makes it safe. If the user would want to enter a comma as a character, the I'd have to create a possibility to choose the delimiter beforehand.
We'll see, maybe I'll create 10 inpud boxes... let's see how this ends first.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|