/*
 * Copyright (c) 2024. Elex. All Rights Reesrved.
 * https://www.elex-project.com/
 */

package com.elex_project.examples.frame;

import javax.swing.*;
import java.awt.*;
import java.util.Arrays;

public class LookAndFeelExample {

	public static void main(String... args) {
		try {
			//UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
			//UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
			UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
		} catch (ClassNotFoundException | InstantiationException | IllegalAccessException |
		         UnsupportedLookAndFeelException e) {
			throw new RuntimeException(e);
		}
		Arrays.stream(UIManager.getInstalledLookAndFeels()).forEach(lookAndFeelInfo -> System.out.println(lookAndFeelInfo));
		// 컨텐트 패널에 버튼 등의 컴포넌트를 구성한다.
		final JPanel contentPane = new JPanel();
		contentPane.setBackground(Color.PINK);
		contentPane.add(new JButton("Hello"));

		// 프레임을 생성한다.
		final JFrame jFrame = new JFrame();
		jFrame.setTitle("Example");
		jFrame.setSize(800, 600);
		jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		jFrame.setContentPane(contentPane);

		// 이벤트 디스패치 스레드에서 프레임을 표시한다.
		SwingUtilities.invokeLater(() -> {
			jFrame.setVisible(true);
		});


	}
}
