Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: How to Hyper-link pages together in Java?

  1. #1
    Junior Member
    Join Date
    Jul 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to Hyper-link pages together in Java?

    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);    
    }
    }


  2. #2
    Banned
    Join Date
    May 2008
    Posts
    25
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: I need to know how to link pages

    You can use the URL class to do this. Or as an alternative, include my AdsPanel in your project and you can create hyperlinks or images with hyperlinks. Demo + code: Clickable banners in your application

  3. #3
    Junior Member
    Join Date
    Jul 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: I need to know how to link pages

    i was hoping maybe you could be my teacher.i like to be ahead of my peers and i my goal is to graduate as the best student in my school.WOULD LIKE TO BE MY TEACHER

  4. #4
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: I need to know how to link pages

    Quote Originally Posted by don.java1 View Post
    i was hoping maybe you could be my teacher.i like to be ahead of my peers and i my goal is to graduate as the best student in my school.WOULD LIKE TO BE MY TEACHER
    I cant imagine ES or anyone else here having the time to be your teacher!
    Your best bet is to read as many online Java tutorials and books as you can. Follow all the examples and try to write your own programs using what you have learnt.

    With some dedication you'll be ahead of your peers no problem.

    If you are having problems then feel free to post here because we will do our best to help you improve. We all started somewhere...

    Sams teach yourself Java in 21 days

    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  5. #5
    Banned
    Join Date
    May 2008
    Posts
    25
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: I need to know how to link pages

    Well, money talks =)

  6. #6
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: I need to know how to link pages

    Quote Originally Posted by Engineeringserver.com View Post
    Well, money talks =)
    haha fair enough!!
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

Similar Threads

  1. How to upload a file by clicking a link instead of button?
    By raghuprasad in forum Java Theory & Questions
    Replies: 2
    Last Post: May 3rd, 2009, 05:21 AM