|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ccs.utils.TextBoxParser
public class TextBoxParser
A multiline text box is an easy way to obtain a list of items from a user: one item per line, you're laughing. However, you then have to parse the contents of the text box into your data structure. This utility class does that for you. It also does the inverse - assembling an array of strings into a string you can feed to the text box.
Constructor Summary | |
---|---|
TextBoxParser()
|
Method Summary | |
---|---|
static java.lang.String |
assembleTextBox(java.lang.String[] srcs)
parses the supplied string array into a string suitable for JTextArea.setText() which is returned. |
static java.lang.String[] |
parseTextBox(java.lang.String src)
parses the result of JTextArea.getText() into strings
(one per line) which are returned. |
static void |
parseTextBox(java.lang.String source,
java.util.Collection<java.lang.String> target,
boolean shouldClear)
parses the result of JTextArea.getText() into strings
(one per line) which are appended to the supplied Vector. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TextBoxParser()
Method Detail |
---|
public static void parseTextBox(java.lang.String source, java.util.Collection<java.lang.String> target, boolean shouldClear)
JTextArea.getText()
into strings
(one per line) which are appended to the supplied Vector.
source
- The multi-line string.target
- Where to put the results.shouldClear
- whether any pre-existing elements should be removed first.public static java.lang.String[] parseTextBox(java.lang.String src)
JTextArea.getText()
into strings
(one per line) which are returned. This is implemented as a wrapper
around the method of three parameters.
src
- The multi-line string.
public static java.lang.String assembleTextBox(java.lang.String[] srcs)
srcs
- The strings to assemble
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |