I made a program for my java class and a part of the assignment is that I need to make a HTML document that will display my applet. I haven't learned much about HTML so I have no idea how to make the document. Can someone please help me? Here is my code:
import java.awt.*;
import java.awt.event.*;
public class colors{
Button button1;
Button button2;
Button button3;
TextField textbox;
Label label1;
public static void main (String args[]){
colors c = new colors();
}
public colors() {
Frame f = new Frame ("Colors");
Button button1 = new Button("Blue");
button1.setBounds(0,205,100,75);
Button button2 = new Button("Red");
button2.setBounds(100,205,100,75);
Button button3 = new Button("Yellow");
button3.setBounds(200,205,100,75);
f.add(button1);
f.add(button2);
f.add(button3);
textbox = new TextField("", 0);
textbox.setBounds(80,105,125,25);
textbox.setText("Which Color?");
f.add(textbox);
label1 = new Label("Click on one of the Buttons to Choose a Color");
f.add(label1);
f.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent we){
System.exit(0);
}
});
f.setSize(300,300);
f.setVisible(true);
button1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent evt){
textbox.setText("Blue");
textbox.setForeground(Color.blue);
}
});
button2.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent evt){
textbox.setText("Red");
textbox.setForeground(Color.red);
}
});
button3.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent evt){
textbox.setText("Yellow");
textbox.setForeground(Color.yellow);
}
});
}
}