Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

need help with JAVA and HTML


  • Please log in to reply

#1
elYo

elYo

    New Member

  • Member
  • Pip
  • 3 posts
Hi,
Im doing a password control in Java to a site.
its an applet and when u press on the button Pass i want it to go to a certain address for example "/elyo.htm"


but i dont know what i should write after the if-thingy

now this is what ive come up with:

import java.awt.*;
import java.awt.event.*;
import java.applet.*;


public class Plain extends Applet implements ActionListener{

Button pass;
TextField password;
public void init () {

setSize(100,50);
setLayout(new GridLayout(2,1));
pass = new Button("Continue");
pass.addActionListener(this);


password = new TextField();
add(password);
add(pass);



}
public void actionPerformed(ActionEvent ev) {
if (password.getText().equals("elYo") || password.getText().equals("elyo")){


}
}
}



hope you understand me and can help me...
ty
  • 0

Advertisements


#2
elYo

elYo

    New Member

  • Topic Starter
  • Member
  • Pip
  • 3 posts
plz help me
  • 0

#3
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 875 posts
elYo,

here's some code:

add this with the other import statements
import java.net.*;

add this to your if statement


String sURL = "http://www.google.com";
//String sURL = "file://C:\\John\\work\\index.htm";
try {
URL url = new URL(sURL); // create a URL
AppletContext context = getAppletContext(); // get browser
context.showDocument(url); // show site
//context.showDocument(url, "_blank"); // new window
} catch (MalformedURLException ex) {
showStatus("URL '" + sURL + "' is incorrect");
}

  • 0

#4
elYo

elYo

    New Member

  • Topic Starter
  • Member
  • Pip
  • 3 posts
ty very much, its works:)
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP