package core;

import java.awt.Color;
import java.io.UnsupportedEncodingException;
import java.util.ResourceBundle;

import javax.swing.BorderFactory;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;

import utils.MenuContextualUI;

public class MenuContextual extends JPopupMenu {

	private static final long serialVersionUID = -8911525675331631854L;
	private ResourceBundle mensajes;
	private JMenuItem botonBorrar;
	private JMenuItem botonMover;

	public MenuContextual() {
		botonBorrar = new JMenuItem();
		botonBorrar.setName("Borrar");
		botonBorrar.setUI(new MenuContextualUI());
		botonBorrar.setBackground(new Color(189,250,107));
		botonBorrar.setBorder(BorderFactory.createEmptyBorder());
		add(botonBorrar);
		botonMover = new JMenuItem();
		botonMover.setName("Mover");
		botonMover.setUI(new MenuContextualUI());
		botonMover.setBackground(new Color(189,250,107));
		botonMover.setBorder(BorderFactory.createEmptyBorder());
		add(botonMover);
	}

	public void setMensajes(ResourceBundle m) {
		mensajes = m;
		try {
			botonBorrar.setText(new String(mensajes.getString("Borrar").getBytes("ISO-8859-1"),"UTF-8"));
			botonMover.setText(new String(mensajes.getString("Mover").getBytes("ISO-8859-1"),"UTF-8"));
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
	}

	public JMenuItem getBotonBorrar() {
		return botonBorrar;
	}

	public JMenuItem getBotonMover() {
		return botonMover;
	}

}