I want to make a button in NetBeans, that when clicked, will open a webpage, wait until the webpage loads, and logs in to that site. I have some code here, but I am not sure what to do after this:
javascript:(function (){
window.open("http://www.stackoverflow.com");
object.onload="LoginToThisSite"
})();
I also have a bookmarklet that logs you in to the site automatically, I am just not sure how to tie that in to the button.
Here is the code I have in NetBeans for the button:
public void actionPerformed(ActionEvent evt) {
String cmd = evt.getActionCommand();
if (cmd == "POST") {
try {
String url = "http://www.stackoverflow.com";
java.awt.Desktop.getDesktop().browse(java.net.URI.create(url));
}
catch (java.io.IOException e) {
System.out.println("Couldn't open browser...");
}
}
}
I would appreciate all the help I can get, as I am horrible at coding in Java.