PlayJPanel.java 1.05 KB
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class PlayJPanel extends JPanel {
	private static final long serialVersionUID = 1L;
	private static final Font titleFont = new Font(new JLabel().getFont().getName(), Font.BOLD, 14);
	
	public PlayJPanel(Interface interf, LightCanvasJPanel lightCanvas) {
		super(new BorderLayout());
		setBorder(BorderFactory.createMatteBorder(4, 0, 0, 0, Color.LIGHT_GRAY));
		
		// title
		JLabel title = new JLabel("Visualizer :");
		title.setFont(titleFont);
		add(title, BorderLayout.NORTH);
		
		// lights
		JPanel centerPanel = new JPanel();
		centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.LINE_AXIS));
		centerPanel.add(Box.createHorizontalGlue());
		centerPanel.add(lightCanvas);
		add(centerPanel, BorderLayout.CENTER);
		
		// controls
		interf.animPlayer = new AnimationPlayer(interf);
		add(interf.animPlayer, BorderLayout.SOUTH);
	}
}