Firstly, forgive my ignorance at the outset if this is an obvious and/or stupid question!
I have created a free standing
java application which is basically a frame with some buttons in it:
import java.awt.*;
import java.awt.event.*;
public class FrameTester
{
public static void main (
String[] args)
{
TempFrame frame = new TempFrame();
frame.setTitle("Frame Test");
frame.setVisible(true);
}
}
class TempFrame extends Frame implements ActionListener
{
//TempFrame constructor
public TempFrame()
{
//set framesize
final int DEFAULT_FRAME_WIDTH = 250;
final int DEFAULT_FRAME_HEIGHT = 150;
setSize (DEFAULT_FRAME_WIDTH, DEFAULT_FRAME_HEIGHT);
//Using GridLayout manager
setLayout (new GridLayout(4,2));
setLocation(100,100);
setTitle("Students - Main Menu");
close = new Button("close");
close.addActionListener(this);
add(close);
inputBox = new Button("Input test");
inputBox.addActionListener(this);
add(inputBox);
testDialog = new TestDialog(this);
}
public void actionPerformed(ActionEvent e)
{
if (e.getSource()==close)
System.exit(0);
else if(e.getSource()==inputBox)
testDialog.setVisible(true);
}
private Button close, inputBox;
private Dialog testDialog;
}
class TestDialog extends Dialog implements ActionListener
{
public TestDialog(Frame f)
{
super(f,true);
setSize (600,500);
setTitle ("Test Writer");
setLocation(300,100);
setLayout(new GridLayout(2,2));
add(new Label("general input"));
student_number=new TextField(10);
//student_number.addKeyListener(this);
add(student_number);
clear=new Button("Clear (close!)");
clear.addActionListener(this);
add(clear);
}
public void actionPerformed(ActionEvent e)
{
if (e.getSource()==clear)
System.exit(0);
}
private Button clear;
private TextField student_number;
}
and I want to embed the frame "frame" in a web page.
Is there a way of using
JSP (Beans or some other method) to embed this code into a web page, without substantially rewriting my code. Any tips or pointers in the right direction, most appreciated.