java - JFrame: No process -
i learning java gui swing library. know how make jframe
, add jbutton
, add actionlistener
e.t.c today jframe
not showing. doing usual. please have @ code , suggest doing wrong..
import javax.swing.*; import java.awt.*; import java.util.concurrent.timeunit; public class mygroup extends jframe { private buttongroup mygroup = new buttongroup(); public mygroup(){ setsize(500, 500); setdefaultcloseoperation(jframe.exit_on_close); setlayout(new flowlayout()); jradiobutton b1 = new jradiobutton("check1"); jradiobutton b2 = new jradiobutton("check2"); jradiobutton b3 = new jradiobutton("check3"); jradiobutton b4 = new jradiobutton("check4"); add(b1); add(b2); add(b3); add(b4); mygroup.add(b1); mygroup.add(b2); mygroup.add(b3); mygroup.add(b4); setvisible(true); } public static void main(string[] args) throws exception{ buttongroup m = new buttongroup(); } }
you need add buttongroup mygroup
frame.
//your code getcontentpane().add(mygroup); setvisible(true);
also in main method need create jframe object , not buttongroup.
mygroup myframe = new mygroup();
Comments
Post a Comment