package edu.school;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import java.awt.FlowLayout;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

/**
 * Информатика, 8 клас, издателство Просвета, 2017
 * Автори: Светла Бойчева, Николина Николова, Елиза Стефанова, Антон Денев
 * 
 * Задача: Проектирайте форма, в която може да се въвежда
 * име на човек. Формата трябва да има два бутона — за извеждане
 * на съобщение и за изход. 
 * Създайте Java приложение MyFriend, в което
 * опишете формата с помощта на графичния редактор.
 * 
 * Версия 1.
 */

public class MyFriendFrame extends JFrame {

	private JPanel contentPane;
	private JTextField txtName;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					MyFriendFrame frame = new MyFriendFrame();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public MyFriendFrame() {
		setTitle("My friend");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 300, 123);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel lblName = new JLabel("\u0418\u043C\u0435: ");
		lblName.setFont(new Font("Tahoma", Font.PLAIN, 12));
		lblName.setBounds(5, 5, 49, 20);
		contentPane.add(lblName);
		
		txtName = new JTextField();
		txtName.setFont(new Font("Tahoma", Font.PLAIN, 12));
		txtName.setBounds(59, 5, 217, 20);
		contentPane.add(txtName);
		txtName.setColumns(10);
		
		JButton btnShowMessage = new JButton("\u0418\u0437\u0432\u0435\u0434\u0438 \u0441\u044A\u043E\u0431\u0449\u0435\u043D\u0438\u0435");
		btnShowMessage.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
			}
		});
		btnShowMessage.setFont(new Font("Tahoma", Font.PLAIN, 12));
		btnShowMessage.setBounds(10, 50, 167, 23);
		contentPane.add(btnShowMessage);
		
		JButton btnExit = new JButton("\u0418\u0437\u0445\u043E\u0434");
		btnExit.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				System.exit(0);
			}
		});
		btnExit.setFont(new Font("Tahoma", Font.PLAIN, 12));
		btnExit.setForeground(new Color(204, 0, 0));
		btnExit.setBounds(187, 50, 89, 23);
		contentPane.add(btnExit);
	}
}
