any one help me in completing my program on FLAMES game
i am not getting how to complete it
please help me

Recommended Answers

All 61 Replies

help me in completing my program

Where is the staring of the code?

Please ask specific questions about your problems.

sorry
i will be posting the code
i am finding an error while deleting the letters in 'FLAMES'

import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class GameFlames extends JFrame implements ActionListener
{
	JTextField first,second;
	JButton calculate;
	String name_1,name_2,reflames;
	StringBuffer name1,name2;
	JLabel msg;
	String res1,res2;
	int length;
	GameHelp gh;
	StringBuffer reflam=new StringBuffer("Flames");
          GameFlames()
          {
        	  Font f=new Font("Monotype Corsiva",Font.BOLD,40);
        	  
        	  JFrame jf=new JFrame("FLAMES");
        	  JPanel j1=new JPanel();
        	  jf.setSize(400,400);
        	  jf.setVisible(true);
        	  jf.setDefaultCloseOperation(jf.EXIT_ON_CLOSE);
        	  JPanel j=new JPanel(new GridBagLayout());
        	  j.setBackground(new Color(158,123,255));
        	  j1.setBackground(new Color(158,123,255));
        	  jf.getContentPane().add(j,BorderLayout.CENTER);
        	  jf.getContentPane().add(j1,BorderLayout.NORTH);
        	  JLabel flame=new JLabel("FLAMES");
        	  flame.setForeground(new Color(65,56,57));
        	  
        	  flame.setFont(f);
        	  j1.add(flame);
        	  GridBagConstraints c=new GridBagConstraints(); 
        	  c.gridx=2;
        	  c.gridy=2;
        	  j.add(new JLabel("Enter your name"),c); 
        	  first=new JTextField(20);
        	  c.gridx=2;
        	  c.gridy=4;
        	  c.insets=new Insets(10,10,10,10);
        	  j.add(first,c);
        	  c.gridx=2;
        	  c.gridy=6;
        	  
        	  j.add(new JLabel("Enter second name"),c);
        	  second =new JTextField(20);
        	  c.gridx=2;
        	  c.gridy=8;
        	  j.add(second,c);
        	  calculate=new JButton("calculate");
        	  calculate.setBackground(new Color(198,129,121));
        	  calculate.setForeground(Color.white);
        	  c.gridx=2;
        	  c.gridy=10;
        	  j.add(calculate,c);
        	  c.gridx=2;
        	  c.gridy=12;
        	  msg=new JLabel("");
        	  j.add(msg,c);
        	  calculate.addActionListener(this);
          }
	
        	
	public static void main(String[] args) 
	{
	      GameFlames gf = new GameFlames();	
	    
	}
	
	private int strlen(String k) {
		// TODO Auto-generated method stub
		return 0;
	}
	String deleteAllOccurences(char removechar)
	{
		reflames.replaceAll(""+removechar, "");
		return reflames;
	}
	
	int compare(StringBuffer k,StringBuffer l)
	{
		char ch;
		for(int i=0;i<k.length();i++)
		{
			ch=k.charAt(i);
			for(int j=0;j<l.length();j++)
			{
				if(ch==l.charAt(j))
				{
					k.deleteCharAt(i);
					l.deleteCharAt(j);
					i--;
					j--;
				
					break;
				}
				
			}
			
			
		}
		k=k.append(l);
		msg.setText(k.toString());
		return k.length();
		
		
	}
   char calculateInFlames(int length)
   {
	 msg.setText("");
	 reflam=reflam.append(reflam);
	 reflames = reflam.toString();
	 for(int i=0;i<25*length;i++)
	 {
		reflames.concat(reflames);
	 }
	   int iterations=0;
	  int nextcharloc=0;
	   while(iterations<6)
	 {
	    char removechar=reflames.charAt(length-1+nextcharloc);		
	    char nextchar = reflames.charAt(length+nextcharloc);
	    reflames= deleteAllOccurences(removechar);
         nextcharloc=reflames.indexOf(nextchar);
         iterations++;
         
	 }
			 
	  
		 return reflames.charAt(0);
   }

	public  void actionPerformed(ActionEvent ae)
	{
		reflam=new StringBuffer("");
		reflames="";
		msg.setText(""); 
		name_1=first.getText();
		 name1=new StringBuffer(name_1);
		 name_2=second.getText();
		 name2=new StringBuffer(name_2);
		 if(name1.length()==0||name2.length()==0)
		 {
			 msg.setText("Enter names ");
			 
		 }
		
		 else 
		 {
			 if(name1.equals(name2))
			 {
				msg.setForeground(Color.BLUE);
				Font f=new Font("arial",Font.BOLD,16);
				msg.setFont(f);
				 msg.setText("enter different names");
				new GameFlames();
			 }
			 
			 
			 length= compare(name1,name2);
			msg.setText(length+"hai");
			char finalresult=calculateInFlames(length); 
		//	msg.setText(finalresult+"");
		 msg.setText(reflames);
		 }
		 
		 
	}

}

this is the code

i am getting error that string index out of range..
i am not understanding why this is happening
please help me

i am finding an error

Please post the FULL text of the error message. It gives the line number where the error occurred and the value of the invalid index.

why this is happening

You are using an index that is out of the range of the array/string.

i supplied inputs to the text box as 'sa' and 'sdd'

Exception in thread "AWT-EventQueue-0" java.lang.StringIndexOutOfBoundsException: String index out of range: 2
at java.lang.String.charAt(Unknown Source)
at GameFlames.calculateInFlames(GameFlames.java:121)
at GameFlames.actionPerformed(GameFlames.java:162)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

StringIndexOutOfBoundsException: String index out of range: 2
at java.lang.String.charAt(Unknown Source)
at GameFlames.calculateInFlames(GameFlames.java:121)

Look in your code at line 121. There is a call to the charAt() method with an arg of 2.
The string must not have 3 letters in it.
Your code must check that the argument to the charAt() method does not go past the end of the String.

yes
but i have to write the same code to have the correct output..

the error is not the same everytime
its giving different values at different times..
please help me in solving the problem..

help me in solving the problem..

Add code to test that the arg passed to charAt() is not past the end of the String.
There is a problem in your logic if you try to look at a character that does not exist.

sorry sir
i didnt get u
i am not good in programming
and thanks for replying

i hope i will be helped in a better way

I'm trying to help you understand what your program is doing and why it is having a problem and to give you hints on how to fix it.
I am NOT going to write any code for you.

Do you understand why you are getting the StringIndexOutOfBoundsException?
Have you looked at your code to see what the values of the index are when the exception occurs? Add a println statement just before the statement where the error occurs to print out the values of the index and the length of the String.

sir i dont need a single line code except ur help
i know that if we are referring to an array out of its index(that is length)
we get this error
and i tried to solve that code manually and then executed the same on the system..
but it failed to work

Did you add the printlns?
What values did they print out?

but it failed to work

Post that section of the code where you try to keep the index from going past the end of the String.

char calculateInFlames(int length)
   {
	 msg.setText("");
	 reflam=reflam.append(reflam);
	 reflames = reflam.toString();
	 for(int i=0;i<25*length;i++)
	 {
		reflames.concat(reflames);
	 }
	   int iterations=0;
	  int nextcharloc=0;
	   while(iterations<6)
	 {
		   System.out.println("hai  helloooo"+length);
	    char removechar=reflames.charAt(length-1+nextcharloc);	
	    System.out.println("hai  helloooo"+length);
	    char nextchar = reflames.charAt(length+nextcharloc);
	    System.out.println("hai  helloooo"+length);
	    reflames= deleteAllOccurences(removechar);
         nextcharloc=reflames.indexOf(nextchar);
         iterations++;
         
	 }
			 
	  
		 return reflames.charAt(0);
   }

i have tried this code
i jst got one hai hello


hai helloooo2
Exception in thread "AWT-EventQueue-0" java.lang.StringIndexOutOfBoundsExceptio
: String index out of range: 1
at java.lang.String.charAt(Unknown Source)
at GameFlames.calculateInFlames(GameFlames.java:122)
at GameFlames.actionPerformed(GameFlames.java:165)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Sou
ce)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)


and one more thing
when i execute this code i am getting two frames displayed

char removechar=reflames.charAt(length-1+nextcharloc);

If this is the line with the error, you need to print out the contents of these three variables:
reflames
length
nextcharloc

Then look at their values and the expression in the charAt: length-1+nextcharloc
The value of that expression must be less than the length of reflames

When printing out Strings add a terminating char to show how long the string is:
System.out.println("reflames=" + reflames + "<");

sir
the string being displayed is empty..
i used a loop to concat the string..
but i think there is something to be done in the code as the string became empty

i think there is something to be done in the code as the string became empty

I guess you need to do some work on your design of that piece of code.

sir but i wrote the code for appending the string using that for loop...
and now the string is empty??

for(int i=0;i<25*length;i++)
	 {
		reflames.concat(reflames);
	 }

is there any problem with this code??

Add a println inside of the loop to show the values of i and reflames for each time the loop goes around.
The output will show you what is happening.

sir i am not able to solve it
i am not able to find the error over there..
please help me

Have you done what I suggested?
If so, post the output from the printlns for those values I listed in my post a few posts back.

If you don't want to follow my suggestions then there is nothing more that I can do.

this is my program ::0
this is my program ::1
this is my program ::2
this is my program ::3
this is my program ::4
this is my program ::5
this is my program ::6
this is my program ::7
this is my program ::8
this is my program ::9
this is my program ::10
this is my program ::11
this is my program ::12
this is my program ::13
this is my program ::14
this is my program ::15
this is my program ::16
this is my program ::17
this is my program ::18
this is my program ::19
this is my program ::20
this is my program ::21
this is my program ::22
this is my program ::23
this is my program ::24
this is my program ::25
this is my program ::26
this is my program ::27
this is my program ::28
this is my program ::29
this is my program ::30
this is my program ::31
this is my program ::32
this is my program ::33
this is my program ::34
this is my program ::35
this is my program ::36
this is my program ::37
this is my program ::38
this is my program ::39
this is my program ::40
this is my program ::41
this is my program ::42
this is my program ::43
this is my program ::44
this is my program ::45
this is my program ::46
this is my program ::47
this is my program ::48
this is my program ::49
i helloooo2 11 0
ception in thread "AWT-EventQueue-0" java.lang.StringIndexOutOfBoundsException
String index out of range: 1
at java.lang.String.charAt(Unknown Source)
at GameFlames.calculateInFlames(GameFlames.java:123)
at GameFlames.actionPerformed(GameFlames.java:166)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Sour
)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
urce)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
urce)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
urce)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)


for the code

char calculateInFlames(int length)
   {
	 msg.setText("");
	 reflam=reflam.append(reflam);
	 reflames = reflam.toString();
	 for(int i=0;i<25*length;i++)
	 {
		 System.out.println("  this is my program ::" +i);
		reflames.concat(reflames);
	 }
	   int iterations=0;
	  int nextcharloc=0;
	   while(iterations<6)
	 {

Yes, that sounds correct.
Now, why is the string empty?

i am unable to find it sir

i have used that code to append the string but unable to find out why its not appending

What did this show:
Add a println inside of the loop to show the values of i and reflames for each time the loop goes around.
The output will show you what is happening.

sir its getting displayed
the code in the for loop is being displayed
jst now i checked it

this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
this is my program ::
ai helloooo2 11 0
xception in thread "AWT-EventQueue-0" java.lang.StringIndexOutOfBoundsException
String index out of range: 1
at java.lang.String.charAt(Unknown Source)
at GameFlames.calculateInFlames(GameFlames.java:123)
at GameFlames.actionPerformed(GameFlames.java:166)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Sour
e)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
ource)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
ource)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
ource)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)


i got this one after adding this code

char calculateInFlames(int length)
   {
	 msg.setText("");
	 reflam=reflam.append(reflam);
	 reflames = reflam.toString();
	 for(int i=0;i<25*length;i++)
	 {
		 System.out.println(" this is my program ::");
		reflames.concat(reflames);
	 }

I suggested that you print the values of some variables.
Do you print any of them?
Your println statement only shows that the loop executed more than a few times, but it did NOT show the values of reflames.
A BIG waste of time to print the same thing out over and over and over and over and over and over and over and over and over etc

the values are getting printed sir
i forgot to post them and in a hurry edited them above

this is my program ::0
this is my program ::1
this is my program ::2
this is my program ::3
this is my program ::4
this is my program ::5
this is my program ::6
this is my program ::7
this is my program ::8
this is my program ::9
this is my program ::10
this is my program ::11
this is my program ::12
this is my program ::13
this is my program ::14
this is my program ::15
this is my program ::16
this is my program ::17
this is my program ::18
this is my program ::19
this is my program ::20
this is my program ::21
this is my program ::22
this is my program ::23
this is my program ::24
this is my program ::25
this is my program ::26
this is my program ::27
this is my program ::28
this is my program ::29
this is my program ::30
this is my program ::31
this is my program ::32
this is my program ::33
this is my program ::34
this is my program ::35
this is my program ::36
this is my program ::37
this is my program ::38
this is my program ::39
this is my program ::40
this is my program ::41
this is my program ::42
this is my program ::43
this is my program ::44
this is my program ::45
this is my program ::46
this is my program ::47
this is my program ::48
this is my program ::49
ai helloooo2 11 0
xception in thread "AWT-EventQueue-0" java.lang.StringIndexOutOfBoundsExceptio
String index out of range: 1
at java.lang.String.charAt(Unknown Source)
at GameFlames.calculateInFlames(GameFlames.java:123)
at GameFlames.actionPerformed(GameFlames.java:166)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Sou
e)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
ource)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
ource)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
ource)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

char calculateInFlames(int length)
   {
	 msg.setText("");
	 reflam=reflam.append(reflam);
	 reflames = reflam.toString();
	 for(int i=0;i<25*length;i++)
	 {
		 System.out.println("  this is my program ::" +i+"  " +reflames);
		reflames.concat(reflames);
	 }
	   int iterations=0;
	  int nextcharloc=0;
	   while(iterations<6)
	 {

reflames are not changed

Besides not changing it looks like reflames is empty. Is that right?
0+0+0+0+0 is still 0.
Many calls to concat will not create anything.

Back up in your code to reflam. What does it have in it?
If nothing, continue going backwards in your code until you find why it doesn't have a value?

sir wont this statement assign flames to reflam??

System.out.println(" hai reflam is having this one   "+reflam);

there is null in reflam everywhere

Why is it null?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.