package swing.podstawy;

import java.awt.Color;
import java.awt.Font;
import java.awt.LayoutManager;

import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;

public class Okno3e_Box {
	// Tu używam już innego layoutu - BoxLayout
	public static void main(String[] args) {
		System.out.println("Początek main");
		
		JFrame okno = new JFrame("Nasza apka");
		okno.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		okno.setSize(600, 400);
		
		LayoutManager layout = new BoxLayout(okno.getContentPane(), BoxLayout.Y_AXIS);
		okno.setLayout(layout);
		
		JLabel label1 = new JLabel("Ala ma kota");
		
		label1.setHorizontalAlignment(JLabel.CENTER);
		label1.setFont(new Font("Arial", Font.BOLD, 30));
		label1.setForeground(Color.RED);
		okno.add(label1);
		
		JLabel label2 = new JLabel("Ola ma psa");
		label2.setHorizontalAlignment(JLabel.RIGHT);
		label2.setFont(new Font("Arial", Font.ITALIC, 30));
		label2.setForeground(Color.BLUE);
		okno.add(label2);
		
		JButton button1 = new JButton("Kliknij mnie");
		button1.setFont(new Font("Arial", Font.BOLD | Font.ITALIC, 30));
		button1.setForeground(Color.GREEN);
		okno.add(button1);

		okno.setVisible(true);

		System.out.println("Koniec main");
	}

}
