|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectlapisx.swing.HTMLFormAccess
This class provides access to the form fields of an HTML document displayed by a JEditorPane, so that an HTML form can be used for input in a Java program.
Only certain types of form fields can be accessed by the get* and set* methods in this class:
Warning: form fields are not accessible until JEditorPane has finished loading the HTML page. To initialize form fields, you should use a PropertyChangeListener that listens for the "page" property to change:
final JEditorPane editor = new JEditorPane (myURL);
editor.addPropertyChangeListener (new PropertyChangeListener () {
public void propertyChange (PropertyChangeEvent event) {
if ("page".equals (event.getPropertyName ()))
HTMLFormAccess access = new HTMLFormAccess (editor);
access.setStringValue (name, value); // etc.
}
});
| Constructor Summary | |
HTMLFormAccess(JEditorPane editor)
Make an HTMLFormAccess object. |
|
| Method Summary | |
boolean |
getBooleanValue(String name)
Gets value of a checkbox or radio button. |
Object |
getFieldModel(String name)
Get the model for a form field. |
String |
getStringValue(String name)
Get value of a text field or single-selection list. |
void |
setBooleanValue(String name,
boolean value)
Set value of a checkbox or radio button. |
void |
setStringValue(String name,
String value)
Set value of a text field or single-selection list. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public HTMLFormAccess(JEditorPane editor)
editor - JEditorPane containing an HTML form to access.| Method Detail |
public String getStringValue(String name)
name - name attribute of form field to access (case-sensitive)
IllegalArgumentException - if no field by that name is found
ClassCastException - if the field is found but is not a text field or single-selection list
public void setStringValue(String name,
String value)
name - name attribute of form field to access (case-sensitive)value - value to store in form field
IllegalArgumentException - if no field by that name is found,
or if the field is a single-selection list and the value is not one
of the choices
ClassCastException - if the field is found but is not a text field or single-selection listpublic boolean getBooleanValue(String name)
name - name attribute of form field to access (case-sensitive)
IllegalArgumentException - if no field by that name is found
ClassCastException - if the field is found but is not a checkbox or radio button
public void setBooleanValue(String name,
boolean value)
name - name attribute of form field to access (case-sensitive)value - value to set in form field
IllegalArgumentException - if no field by that name is found
ClassCastException - if the field is found but is not a checkbox or radio buttonpublic Object getFieldModel(String name)
name - name attribute of form field to access (case-sensitive)
IllegalArgumentException - if no field by that name is found
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||