Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Manju Tcs   on Jan 12 In Java Category.

  
Question Answered By: Bonnie Hughes   on Jan 12

try this

Send = new Button("Send");
add(Send,BorderLayout.WEST);



--------------------------------------------------------------------------------

// Modifed
import java.awt.*;
import java.applet.*;
import java.util.*;
import java.awt.event.*;
/*
<applet code = "MessageWindow" width=400 height = 200>
</applet>
*/

public class  MessageWindow extends applet  implements ActionListener
{
Button Send;
TextArea A1,A2;

public void  init()
{
setBackground(Color.cyan);
setLayout(new BorderLayout());
add(new TextArea(" ",10,30),BorderLayout.NORTH);
add(new TextArea(" ",5,30),BorderLayout.SOUTH);

// I put this
Send = new Button("Send");
//I change dis:)
add(Send,BorderLayout.WEST);

Send.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
String str = ae.getActionCommand();
if(str.equals("Send"))
{
repaint();
}
else
{
repaint();
};
}
}

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Null Pointer exception Or get search suggestion and latest updates.


Tagged: