samedi 2 juillet 2016

HTML, and Java Combiing

I am working on a project for my online class it's provided no background information on inputting java into HTMl heres the assignment description: Create a Java applet registration form with a minimum of 5 fields and an OK and Cancel button. You will also need to create the HTML code to display your applet. I already have the java script for this but I need someone recommend what I do for the HTMl part of this.

Here the java script

import java.awt.FlowLayout;

import java.awt.event.*;

import javax.swing.JApplet;

import javax.swing.JTextField;

import javax.swing.JButton;

public class MyApplet extends JApplet {

JButton okButton = new JButton("Okay");

JButton cancelButton = new JButton("Cancel");

public void init(){

    this.getContentPane().setLayout(new FlowLayout());

    JTextField f1 = new JTextField("Hi");


field.setEditable(f1);

add(f1);

    JTextField f2 = new JTextField("Not available");

    field.setEditable(false);

    add(f2);

    JTextField f3 = new JTextField("Input ok");

    field.setEditable(false);

    add(f3);

    JTextField f4 = new JTextField("or press cancel");

    field.setEditable(false);

    add(f4);

    JTextField f5 = new JTextField("Goodbye);

    field.setEditable(false);

    add(f5);

    okButton.addActionListener(new ActionListener(){

        public void actionPerformed(ActionEvent e){

            System.out.println("Okay");

        }

    });

    getContentPane().add(okButton);

    cancelButton.addActionListener(new ActionListener(){

        public void actionPerformed(ActionEvent e){

            System.out.println("Okay");`enter code here`
        }

    });

    getContentPane().add(cancelButton);

}

}

Aucun commentaire:

Enregistrer un commentaire