Applet does not loads Frame in IE
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   sunil_manwani
Posted On:   Saturday, September 22, 2001 01:17 AM

I have an applet which loads a chat Frame on pressing Submit button. Code works fine in appletviewer, but in IE or Netscape applet starts but Frame does not popup. here's my code import java.awt.*; import java.applet.*; import java.net.*; public class Applet1 extends Applet { public void init() { setLayout(null); setSize(371,143); add(textField1); textField1.setFont(new Font("Dialog", Font.PLAIN, 12)); textField1.setBounds(48,72,42,24); textField1.setColumns(3); add(textField2); textField2.setFont(new Font("Dialog", Font.PLAIN, 12)); textField2.setBounds(120,72,42,24);    More>>

I have an applet which loads a chat Frame on pressing Submit button. Code works fine in appletviewer, but in IE or Netscape applet starts but Frame does not popup.


here's my code



import java.awt.*;
import java.applet.*;
import java.net.*;

public class Applet1 extends Applet
{
public void init()
{
setLayout(null);
setSize(371,143);
add(textField1);
textField1.setFont(new Font("Dialog", Font.PLAIN, 12));
textField1.setBounds(48,72,42,24);
textField1.setColumns(3);
add(textField2);
textField2.setFont(new Font("Dialog", Font.PLAIN, 12));
textField2.setBounds(120,72,42,24);
textField2.setColumns(3);
add(textField3);
textField3.setFont(new Font("Dialog", Font.PLAIN, 12));
textField3.setBounds(192,72,42,24);
textField3.setColumns(3);
add(textField4);
textField4.setFont(new Font("Dialog", Font.PLAIN, 12));
textField4.setBounds(264,72,42,24);
textField4.setColumns(3);
button1.setLabel("Submit");
add(button1);
button1.setBackground(java.awt.Color.lightGray);
button1.setBounds(120,108,100,23);
label1.setText("please enter an IP address OR if same computer press \'Submit\'");
add(label1);
label1.setBounds(12,12,372,48);
label2.setText(".");
add(label2);
label2.setBounds(96,72,12,24);
label3.setText(".");
add(label3);
label3.setBounds(180,72,12,24);
label4.setText(".");
add(label4);
label4.setBounds(252,72,12,24);

EventAction eventAction = new EventAction();
button1.addActionListener(eventAction);
}

java.awt.TextField textField1 = new java.awt.TextField();
java.awt.TextField textField2 = new java.awt.TextField();
java.awt.TextField textField3 = new java.awt.TextField();
java.awt.TextField textField4 = new java.awt.TextField();
java.awt.Button button1 = new java.awt.Button();
java.awt.Label label1 = new java.awt.Label();
java.awt.Label label2 = new java.awt.Label();
java.awt.Label label3 = new java.awt.Label();
java.awt.Label label4 = new java.awt.Label();

class EventAction implements java.awt.event.ActionListener
{
public void actionPerformed(java.awt.event.ActionEvent event)
{
Object object = event.getSource();
if (object == button1)
button1_ActionPerformed(event);
}
}

void button1_ActionPerformed(java.awt.event.ActionEvent event)
{
InetAddress clientAddr = null;
String text1 = textField1.getText();
String text2 = textField2.getText();
String text3 = textField3.getText();
String text4 = textField4.getText();
try
{
clientAddr = InetAddress.getByName(text1 +"."+ text2 +"."+ text3 +"."+ text4);
ChatGUI cg=new ChatGUI(clientAddr, false);
Thread t=new Thread(cg);
t.start();
}
catch(Exception e)
{
System.out.println(" "+e);
try
{
clientAddr=InetAddress.getLocalHost();
ChatGUI cg=new ChatGUI(clientAddr, false);
Thread t=new Thread(cg);
t.start();
}
catch(Exception ee)
{
System.out.println(" "+ee);
}
}
}
}



please suggest!

   <<Less
About | Sitemap | Contact