Java-2 2016 Hafta-8 Örnek-2

java2_16_hafta8_2

import java.awt.event.*;
import java.awt.*;
import javax.swing.*;

public class tasarim implements ActionListener {

	JLabel jlab;
	JRadioButton[] jrb;
	public tasarim() {
		
		JFrame jfrm = new JFrame("Tasarim");
		jfrm.setSize(250,150);
		jfrm.setLayout(new FlowLayout());
		jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	
		JPanel jpn_ana = new JPanel();
		jpn_ana.setPreferredSize(new Dimension(245,145));
		
		JPanel jpn_soru= new JPanel();
		jpn_soru.setLayout(new FlowLayout(FlowLayout.LEFT));
		jpn_soru.setPreferredSize(new Dimension(240,35));
		jlab= new JLabel("Soru1:....");
		jpn_soru.add(jlab);
		
		
		JPanel jpn_secenek= new JPanel();
		jpn_secenek.setLayout(new GridLayout(2,2));
		jpn_secenek.setPreferredSize(new Dimension(240,50));
		
		ButtonGroup bg = new ButtonGroup();
		jrb= new JRadioButton[4];
		jrb[0]= new JRadioButton("A).....");
		jrb[0].setSelected(true);
		jrb[1]= new JRadioButton("B).....");
		jrb[2]= new JRadioButton("C).....");
		jrb[3]= new JRadioButton("D).....");
		bg.add(jrb[0]);
		bg.add(jrb[1]);
		bg.add(jrb[2]);
		bg.add(jrb[3]);
		
		jpn_secenek.add(jrb[0]);
		jpn_secenek.add(jrb[1]);
		jpn_secenek.add(jrb[2]);
		jpn_secenek.add(jrb[3]);
		
		JPanel jpn_buton= new JPanel();
		jpn_buton.setLayout(new GridLayout(1,2));
		jpn_buton.setPreferredSize(new Dimension(240,35));
		
		JPanel jpn_b1= new JPanel();
		jpn_b1.setLayout(new FlowLayout(FlowLayout.LEFT));
		JPanel jpn_b2= new JPanel();
		jpn_b2.setLayout(new FlowLayout(FlowLayout.RIGHT));
		
		JButton jbtn1= new JButton("Önceki");
		JButton jbtn2= new JButton("Sonraki");
		jpn_b1.add(jbtn1);
		jpn_b2.add(jbtn2);
		
		
		jpn_buton.add(jpn_b1);
		jpn_buton.add(jpn_b2);
		
		jpn_ana.add(jpn_soru);
		jpn_ana.add(jpn_secenek);
		jpn_ana.add(jpn_buton);
				
		jfrm.add(jpn_ana);
		jfrm.setVisible(true);
	}
	@Override
	public void actionPerformed(ActionEvent arg0) {
		
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		new tasarim();

	}

}

 

Share