java - StackOverflow Error when running -


my code compiles when run it, weird error message pops up.

the error message says

"java.lang.stackoverflowerror:null(in sun.awt.win32graphicsconfig).

what it's supposed print out panel 4x10 of button array button list stored info far. buttons don't right that's fine because care actual graphic now. there class goes array list can put in comments if needed.

here code:

import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.scanner; import java.util.arraylist; import java.util.*; import java.io.file; import java.io.printwriter; public class culminatingprojectgui extends jframe implements actionlistener {     private static jbutton[][] jbtnumbuttons = new jbutton[10][4];     private static jbutton jbtlist = new jbutton("list");     arraylist<culminating> seats = new arraylist<culminating>();     public culminatingprojectgui()     {     //construct jfame object container other objects     jframe frame = new jframe("fly buddies");     //set dimensions of window     frame.setsize(750, 720);     //creates pane content     jpanel pane = new jpanel();     pane.setlayout(new gridlayout(11, 4));       jbtlist.addactionlistener(new culminatingprojectgui());     (int m = 1,n = 1; n < 11;)     {          jbtnumbuttons[n][m].addactionlistener(new culminatingprojectgui());         if(n == 1)         {             jbtnumbuttons[n][m].settext(m + "a");         }         else if(n == 2)         {             jbtnumbuttons[n][m].settext(m + "b");         }         else if(n == 3)         {             jbtnumbuttons[n][m].settext(m + "c");         }         else if(n == 4)         {             jbtnumbuttons[n][m].settext(m + "d");         }         pane.add(jbtnumbuttons[n][m]);         m++;          if(m > 4)         {             n++;             m = 0;         }     }     //add content pane frame     pane.add(jbtlist);     frame.setcontentpane(pane);       //display frame - window     frame.setvisible(true);     //bring window front     frame.tofront();       }     public static void main(string []args)     {         culminatingprojectgui frame = new culminatingprojectgui();         //create seat array. still testing.     }     public void actionperformed(actionevent e)     {         if (e.getactioncommand().equals("list"))         {             string listedflyers = "";             (int h =0;h< 40;h++)             {                  listedflyers = listedflyers + seats.get(h).tostring() + "\n";             }              jtextarea text = new jtextarea(listedflyers, 10, 40);             jscrollpane scroll = new jscrollpane(text);         }          else if (e.getactioncommand().equals(""))         {          }     } } 

jbtnumbuttons[n][m].addactionlistener(new culminatingprojectgui());

here problem. create new instance of culminatingprojectgui, , in constructor create again , again. should consider following:

jbtnumbuttons[n][m].addactionlistener(this);


Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -