java - JMenuBar cannot find symbol error -
i have problem trying implement jmenubar keep getting cannot find symbol error. have jframe in separate class along main method , jframe instatiates object of mainpanel class. missing here? appreciated, thank you!
the full error message reads
cannot find symbol
symbol: method setjmenubar (jmenubar)
location: class mainpanel
public class mainpanel extends jpanel { //whole bunch of code jmenubar menubar; jmenu archive; public uppgift2panel(){ //whole bunch of code menubar = new jmenubar(); archive = new jmenu(); menubar.add(archive); setjmenubar(menubar); //whole bunch of code } }
a jpanel
doesn't have setjmenubar(...)
method.
you add menubar frame using setjmenubar(...)
method of jframe
.
read section swing tutorial on how use menus working examples started.
start working code. tutorial code show how better structure code. keep tutorial link handy swing basics.
Comments
Post a Comment