If you mean that this program should display a Web page in (or as if in) the user's Web browser, but then proceed to fill in the forms on that page: the only way to do that is if your form-filling program is part of the browser itself. That either means
2) Writing your own Web browser which would have your capability built-in. This you could do in Java, in theory, starting with an HTML component like HTMLEditorKit, but it would be an enormous amount of work, and since modern browsers already have this capability, have little to no benefit. Or
3) Writing a proxy server -- a Java program that sits inbetween the user's browser and the Internet. The proxy server would have a chance to examine and potentially change any of the web pages that passes through it. The Muffin proxy server (www.doit.org) has a plugin architecture, so you might be able to add this capability -- if it's not already in there -- as a Muffin plugin. The user would have to configure their browser to use Muffin as a proxy, and configure Muffin to use their normal proxy (if any).
Now, if you're really interested in just one particular form on one particular web site, there's a fourth option: you can write a desktop Java program which uses the java.net.HttpURLConnection class to submit the form data directly, bypassing the displayed HTML page altogether. But it doesn't sound like that's what you're interested in doing. [ May 23, 2008: Message edited by: Ernest Friedman-Hill ]