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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -