java - error undefined for defined constructor -


i'm getting error have been working on, on side time error "the constructor hangmanpanel() undefined" defined in hangman().., think may want me use parameters i'm not sure ones....

hangman.java

import javax.swing.*; public class hangman extends jframe{     private static final long serialversionuid = -6224212014648478637l;      public static void main(string[] args){         new hangman();      }      public hangman() {         this.setsize(800, 500);         this.setdefaultcloseoperation(jframe.exit_on_close);         this.settitle("hangman web app");          hangmanpanel panel = new hangmanpanel();         this.add(panel);          this.setvisible(true);         }  } 

hangmanpanel.java

import java.awt.event.*; import java.util.*; import javax.swing.*;   public class hangmanpanel extends jpanel {     static boolean found;     private static final long serialversionuid = -5793357804828609325l;      public static string answerkey() {         //get random array element         string array[] = new string[10];         array[0] = "hamlet";         array[1] = "mysts of avalon";         array[2] = "the iliad";         array[3] = "tales edger allan poe";         array[4] = "the children of hurin";         array[5] = "the red b" +                 "+adge of courage";         array[6] = "of mice , men";         array[7] =  "utopia";          array[8] =  "chariots of gods";         array[9] =  "a brief history of time";          arraylist<string> list = new arraylist<string>(arrays.aslist(array));         collections.shuffle(list);         string s = list.get(0);         return s;     }      public stringbuilder dashreplace(string s) {         //replace non-white space char dashes , creates stringbuilder object         string tw = s.replaceall("\\s", "-");          system.out.print(tw + "\n");           stringbuilder answerkey = new stringbuilder(tw);         return answerkey;     }     public static int findandreplace(string s, jlabel answerkey, string sc,             char ch) {         //find position of user input , replace         int pos = -1;         found = false;         while(true){         pos = s.indexof(sc, pos+1);         if(pos < 0){              break;         }else{             found = true;             stringbuilder builder = new stringbuilder(answerkey.gettext());             builder.setcharat(pos, ch);             answerkey.settext(builder.tostring());         }          }         jlabel answerkey2 = new jlabel(answerkey.tostring());         return pos;     }         public hangmanpanel(final string s){         this.setlayout(null);          jlabel heading = new jlabel("welcome hangman app");         jbutton button = new jbutton("ok");         //get input          jlabel tflable = new jlabel("please enter letter:");           final jlabel answerkey = new jlabel(dashreplace(answerkey()).tostring());          final jtextfield text = new jtextfield(10);           heading.setsize(200, 50);         tflable.setsize(150, 50);         text.setsize(50, 30);         button.setsize(60, 20);         answerkey.setsize(200, 100);          heading.setlocation(300, 10);         tflable.setlocation(50, 40);         text.setlocation(50, 80);         button.setlocation(100, 85);         answerkey.setlocation(100,85);          this.add(heading);         this.add(tflable);         this.add(text);         this.add(button);         this.add(answerkey);           button.addactionlistener(new actionlistener() {             @override             public void actionperformed(actionevent e) {                 // can't access text                 string sc = text.gettext();                 char ch = sc.charat(0);                 findandreplace(s, answerkey, sc, ch);             }         });      }  } 

the error message refers class hangmanpanel not having constructor hangmanpanel(). question you: given understanding of error message, can @ code , see why compiler might telling this?


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -