My applet will run just fine in the applet viewer, but not at all in my browser...
File is named Lab7.java
In my browser, I use this:Code:import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.TitledBorder; public class Lab7 extends JApplet implements ActionListener { JTextField inputOne; JTextField inputTwo; JTextField outputOne; JButton accept; JButton exit; public void init() { Container container = getContentPane(); container.setLayout(new BorderLayout()); inputOne = new JTextField(10); inputTwo = new JTextField(10); outputOne = new JTextField(25); accept = new JButton("Accept"); outputOne.setEditable(false); JPanel p1 = new JPanel(); p1.setLayout(new GridLayout(3,3)); p1.add(inputOne); p1.add(inputTwo); p1.add(outputOne); p1.add(accept); p1.setBackground(Color.blue); p1.setBorder(new TitledBorder("Last Name then First Name")); accept.addActionListener(this); container.add(p1,BorderLayout.NORTH); } public void actionPerformed(ActionEvent e) { if (e.getSource() == accept) outputOne.setText(inputOne.getText() + " " + inputTwo.getText()); } }
Any ideas?Code:<HTML> <APPLET CODE="Lab7.class" height = 400 width = 400></applet></HTML>
Thanks!




Reply With Quote