Tugas Netbeans 7

package latihan2;


import java.awt.*;

import javax.swing.*;

public class JRadButton3 extends JFrame  {

     JRadioButton rbtpil1,rbtpil2,rbtpil3,rbtpil4,rbtpil5,rbtpil6,rbtpil7,
             rbtpil8,rbtpil9,rbtpil10,rbtpil11,rbtpil12;
     TextField txtinput1,txtinput2;
    
    JRadButton3 () {
        txtinput1 = new TextField ();
        txtinput2 = new TextField ();
       
            rbtpil1 = new JRadioButton ("M");
            rbtpil2 = new JRadioButton ("M");
            rbtpil3 = new JRadioButton ("CM");
            rbtpil4 = new JRadioButton ("CM");
            rbtpil5 = new JRadioButton ("MM");
            rbtpil6= new JRadioButton ("MM");
            rbtpil7 = new JRadioButton ("INCI");
            rbtpil8 = new JRadioButton ("INCI");
            rbtpil9 = new JRadioButton ("MIL");
            rbtpil10 = new JRadioButton ("MIL");
            rbtpil11 = new JRadioButton ("KM");
            rbtpil12= new JRadioButton ("KM");
           
        
   

                   
                    Container cp = this.getContentPane();
                   
                  cp.setLayout (new GridLayout (8,2,6,6));
                   cp.add (txtinput1);
                   cp.add (txtinput2);
                  cp.add (rbtpil1);
                  cp.add (rbtpil2);
                  cp.add (rbtpil3);
                  cp.add (rbtpil4);
                  cp.add (rbtpil5);
                  cp.add (rbtpil6);
                  cp.add (rbtpil7);
                  cp.add (rbtpil8);
                  cp.add (rbtpil9);
                  cp.add (rbtpil10);
                  cp.add (rbtpil11);
                  cp.add (rbtpil12);
              
                  setSize (250,300);
                  setLocationRelativeTo (null);
                  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                   setVisible (true);
                  setTitle ("Konversi Biner");

    }                 
 
   public static void main (String args [] ){

 
        JRadButton3 frm = new JRadButton3 ();
 
   }
   
   }

Leave a Reply