package com.qy.ui;

import javax.swing.JFrame;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.UIManager;

import com.qy.Interfaces.SmaliApkToolsPath;

import javax.swing.JButton;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public class EditToDalog extends JFrame{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JTextField textField;
	public EditToDalog(String title,String text,String fileName,SmaliApkToolsPath path) {
		super(title);
		setResizable(false);
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		initView(text,fileName,path);
	}
	public void initView(String text,String fileName,final SmaliApkToolsPath path) {
		// TODO Auto-generated constructor stub
		setSize(577, 260);
		getContentPane().setLayout(null);
		
		JTextArea lblNewLabel = new JTextArea(text);
		lblNewLabel.setBackground(UIManager.getColor("Label.background"));
		lblNewLabel.setEditable(false);
		lblNewLabel.setLineWrap(true);
		lblNewLabel.setBounds(47, 12, 438, 119);
		getContentPane().add(lblNewLabel);
		
		textField = new JTextField();
		textField.setBounds(47, 143, 501, 24);
		getContentPane().add(textField);
		textField.setColumns(10);
		textField.setText(fileName);
		
		JButton btnOk = new JButton("ok");
		btnOk.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				path.smaliPath(textField.getText());
				EditToDalog.this.dispose();
			}
		});
		btnOk.setBounds(435, 179, 113, 27);
		getContentPane().add(btnOk);
		setVisible(true);
	}
}
