package org.kne.cloud.klalb.uitool;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.border.LineBorder;

import org.kne.cloud.network.klalb.ui.UIEnv;

import javax.swing.SwingConstants;

import javax.swing.SpringLayout;

public class SettingItem extends JPanel {
	protected JLabel label;
	private JPanel sub;
	
	public JLabel getLabel() {
		return label;
	}
	public SettingItem(String text,int w,int h){
		this(text,UIEnv.getFont().deriveFont(15.0f),w,h);
	}
	public JPanel getPanel(){
		return sub;
	}
	/**
	 * @wbp.parser.constructor
	 */
	public SettingItem(String text,Font f,int w,int h){
		setSize(w, h);
		setPreferredSize(new Dimension(w, h));
		setBackground(UIEnv.getHalfTransparentDefaultColor());
		SpringLayout springLayout = new SpringLayout();
		setLayout(springLayout);
		//setOpaque(false);
		sub = new JPanel();
		springLayout.putConstraint(SpringLayout.NORTH, sub, 0, SpringLayout.NORTH, this);
		springLayout.putConstraint(SpringLayout.WEST, sub, 20, SpringLayout.WEST, this);
		springLayout.putConstraint(SpringLayout.SOUTH, sub, 0, SpringLayout.SOUTH, this);
		springLayout.putConstraint(SpringLayout.EAST, sub, -20, SpringLayout.EAST, this);
		sub.setOpaque(false);
		add(sub);
		sub.setLayout(new BorderLayout(5, 0));
		label = new JLabel(text);
		label.setFont(f);
		sub.add(label, BorderLayout.WEST);
	}
}
