Java-2 2016 Hafta-6 Örnek-1

java2_2016_hafta6_ornek1

 

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


public class grid implements ActionListener {

	public grid() {
	
		JFrame jfrm = new JFrame();
		//jfrm.setSize(150,150);
		jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		jfrm.setLayout(new GridLayout(2,2));
		
		JLabel jlab1 = new JLabel("eleman-1");
		JButton jbtn1 = new JButton("Button-1");
		JLabel jlab2 = new JLabel("eleman-2");
		JButton jbtn2 = new JButton("Button-2");
		
		JPanel jpn1 = new JPanel();
		JPanel jpn2 = new JPanel();
		JPanel jpn3 = new JPanel();
		JPanel jpn4 = new JPanel();
		
		
		jpn1.add(jlab1);
		jpn2.add(jbtn1);
		jpn3.add(jlab2);
		jpn4.add(jbtn2);
		
		jfrm.add(jpn1);
		jfrm.add(jpn2);
		jfrm.add(jpn3);
		jfrm.add(jpn4);
		
		jfrm.pack();
		jfrm.setVisible(true);
		
	}

	@Override
	public void actionPerformed(ActionEvent arg0) {
		

	}

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

}

 

Share