Package practica1.actions

Source Code of practica1.actions.ActionOpciones

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package practica1.actions;

import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import javax.swing.AbstractAction;
import javax.swing.KeyStroke;
import practica1.Practica1;
import practica1.language.Language;
import practica1.language.LanguageEvent;
import practica1.language.LanguageListener;
import practica1.ui.dialog.DialogOpciones;

/**
* Clase que implementa la acción de mostrar las opciones de la aplicación
* @author Miguel González - Ceura
*/
public class ActionOpciones extends AbstractAction implements LanguageListener {
    /**
     * Constructor de la clase
     */
    public ActionOpciones() {
        super(Language.getI().getP("OPCIONES"), null);

        Language.getI().addLanguageListener(this);
       
        putValue(SHORT_DESCRIPTION, Language.getI().getP("OPCIONES_APLICACION"));
        putValue(NAME, Language.getI().getP("OPCIONES"));
        putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_O,
                InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK));
        putValue(MNEMONIC_KEY, new Integer(KeyEvent.VK_O));
        putValue(SELECTED_KEY, Boolean.TRUE);
    }
   
   
    /**
     * Cuando sucede la acción nos encargamos de preguntar que experimento
     * se quiere abrir y lo cargamos en el modelo de la práctica
     * @param e ActionEvent Evento producido
     */
    @Override
    public void actionPerformed(ActionEvent e) {
        DialogOpciones dialog = new DialogOpciones(Practica1.getInstance());
        dialog.setVisible(true);
    }

    /**
     * Al cambiar el idioma actualizamos el nombre y la descripción
     * @param evt LanguageEvent
     */
    @Override
    public void idiomaChange(LanguageEvent evt) {
        putValue(SHORT_DESCRIPTION, Language.getI().getP("OPCIONES_APLICACION"));
        putValue(NAME, Language.getI().getP("OPCIONES"));
    }
}
TOP

Related Classes of practica1.actions.ActionOpciones

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.