AM TRYING TO HYPER-LINK PAGES TOGETHER IN JAVA BUT I DONT KNOW HOW TO DO IT.IF I CLICK A BUTTON,I WANT IT TO GO TO THE NEXT PAGE.THIS IS THE CODE AM TRYING TO HYPER-LINK TO ANOTHER PAGE.
PAGE1
import java.applet.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.io.*; import java.util.*; /*<applet code="Application.class" height="600" width="550"> </applet> */ public class Application extends Applet implements ActionListener { Label lheading = new Label("Application Form", Label.CENTER); Label lheading2 = new Label("Applying For"); Label lgrad = new Label("Graduation Degree Program*"); TextField tgrad = new TextField(10); Label lskul = new Label("School*"); TextField tskul = new TextField(15); Label lheading3 = new Label("Personal Details"); Label lname = new Label("Name*"); TextField tname = new TextField(10); Label lmiddle = new Label("Middle*"); TextField tmiddle = new TextField(10); Label llast = new Label("Last*"); TextField tlast = new TextField(10); Label laddress = new Label("Address*"); TextField taddress = new TextField(15); Label lcity = new Label("City*"); TextField tcity = new TextField(7); Label lstate = new Label("State*"); TextField tstate = new TextField(7); Label lZipcode = new Label("Zipcode*"); TextField tzipcode = new TextField(5); Label lcountry = new Label("Country*"); TextField tcountry = new TextField(10); Label lphone = new Label("Phone(Residence)*"); TextField tphone = new TextField(9); Label lcountrycode = new Label("Country Code*"); TextField tcountrycode = new TextField(5); Label lareacode1 = new Label("Area Code*"); TextField tareacode1 = new TextField(5); Label lphoneno1 = new Label("Phone Number*"); TextField tphoneno1 = new TextField(9); Label lphone2 = new Label("Phone(Office)*"); TextField tphone2 = new TextField(9); Label lcountrycode1 = new Label("Country Code*"); TextField tcountrycode1 = new TextField(5); Label lareacode2 = new Label("Area Code*"); TextField tareacode2 = new TextField(5); Label lphoneno2 = new Label("Phone Number*"); TextField tphoneno2 = new TextField(9); Label lmail = new Label("E-mail Address*"); TextField tmail = new TextField(15); Label lgender = new Label("Gender"); Choice gender = new Choice(); Label ldate = new Label("Date*"); Choice mdate = new Choice(); Choice ddate = new Choice(); Choice ydate = new Choice(); Label lstatus = new Label("Citizenship Status*"); Choice cstatus = new Choice(); Button cont = new Button("Continue"); public void init() { ApplicationForm(); } public void ApplicationForm() { setLayout(new FlowLayout(20,5,5)); add(lheading); add(lheading2); add(lgrad); add(tgrad); add(lskul); add(tskul); add(lheading3); add(lname); add(tname); add(lmiddle); add(tmiddle); add(llast); add(tlast); add(laddress); add(taddress); add(lcity); add(tcity); add(lstate); add(tstate); add(lZipcode); add(lcountry); add(tcountry); add(lphone); add(tphone); add(lcountrycode); add(tcountrycode); add(lareacode1); add(tareacode1); add(lphoneno1); add(tphoneno1); add(lphone2); add(tphone2); add(lcountrycode1); add(tcountrycode1); add(lareacode2); add(tareacode2); add(lphoneno2); add(tphoneno2); add(lmail); add(tmail); add(lgender); gender.add("Male"); gender.add("Female"); add(gender); add(ldate); mdate.add("Jan"); mdate.add("Feb"); mdate.add("Mar"); mdate.add("Apr"); mdate.add("May"); mdate.add("Jun"); mdate.add("Jul"); mdate.add("Aug"); mdate.add("Sep"); mdate.add("Oct"); mdate.add("Nov"); mdate.add("Dec"); add(mdate); ddate.add("1"); ddate.add("2"); ddate.add("3"); ddate.add("4"); ddate.add("5"); ddate.add("6"); ddate.add("8"); ddate.add("9"); ddate.add("10"); ddate.add("11"); ddate.add("12"); ddate.add("13"); ddate.add("14"); ddate.add("15"); ddate.add("16"); add(ddate); ydate.add("90"); ydate.add("89"); ydate.add("88"); ydate.add("87"); ydate.add("86"); ydate.add("85"); ydate.add("84"); ydate.add("83"); ydate.add("82"); ydate.add("81"); ydate.add("80"); ydate.add("79"); ydate.add("78"); ydate.add("77"); ydate.add("76"); ydate.add("75"); add(ydate); add(lstatus); cstatus.add("U.S Citizen"); cstatus.add("U.S Permanent Resident"); cstatus.add("Not a U.S"); cstatus.add("Decline to State"); add(cstatus); add(cont); cont.addActionListener(this); } public void actionPerformed(ActionEvent ae1) { Object o1 = ae1.getSource(); if(o1 == cont) { if((tname.getText().equals("")) || (tmiddle.getText().equals(""))|| (tlast.getText().equals(""))|| (taddress.getText().equals(""))|| (tphone.getText().equals(""))|| (tmail.getText().equals(""))|| (mdate.getName().equals("jan"))) JOptionPane.showMessageDialog(null,"The Asteric Field Must Not Be Blank"); String s = "Graduation Degree program>" + tgrad.getText() + "School>" + tskul.getText() + "FirstName>" + tname.getText() + "MiddleName>" + tmiddle.getText() + "LastName>" + tlast.getText()+ "Address>" + taddress.getText() + "City>" + tcity.getText() + "State>" + tstate.getText() + "Zipcode>" + tzipcode.getText()+ "Country>" + tcountry.getText()+ "Phone(Residence)>" + tphone.getText()+ "Country Code>" + tcountrycode.getText()+ "Area Code" + tareacode1.getText()+ "Phone Number>" + tphoneno1.getText()+ "Phone(Office)>" + tphone2.getText()+ "Country Code>" + tcountrycode1.getText()+ "Area Code>" + tareacode2.getText()+ "Phone Number>" + tphoneno2.getText()+ "E-Mail Address" + tmail.getText()+ "Gender>" + gender.getName()+ "Date Of Birth>" + mdate.getName()+ "/" + ddate.getName()+"/"+ ydate.getName()+ "Citizenship Status>" + cstatus.getName(); try { RandomAccessFile lFile = new RandomAccessFile("C:/Users/Dotun/Documents/application.txt","rw"); lFile.seek(lFile.length()); lFile.writeBytes(s); } catch(IOException ie) { showStatus("Unable to Calculate due to invalid value input" + ie); } } } }
THIS IS THE PAGE YOU WILL HYPER-LINK THE ABOVE CODE TOO.
PAGE2
import java.applet.*; import java.awt.*; /*<applet code="Welcome.class" height="600" width="550"> </applet> */ public class Welcome extends Applet { public void init() { Label lheading = new Label("WELCOME TO THE SCHOOL", Label.CENTER); add(lheading); } }