Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
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
  • 876 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