Package thegame.layers.options

Source Code of thegame.layers.options.FieldSlider

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package thegame.layers.options;

import java.util.List;
import thegame.gui.GameMenuElement;
import thegame.gui.SelectionMenuCell;
import thegame.gui.SelectionMenuComponent;
import thegame.layers.Options;

/**
*
* @author www.b23prodtm.info
*/
public class FieldSlider<VALUE> extends Field<VALUE> {

    public FieldSlider(String name, VALUE[] values, VALUE currentDefaultValue) {
        super(name, values, currentDefaultValue);
    }

  
    @Override
    public SelectionMenuComponent makeOptionSlider(Options options, SelectionMenuComponent parent, List<SelectionMenuCell> menu) {
        for (final VALUE v : values) {
            Runnable validate;
            Runnable invalidate;
            validate = new Runnable() {

                public void run() {
                    currentValue = v;
                }
            };
            invalidate = new Runnable() {

                public void run() {
                    currentValue = defaultValue;
                }
            };
            GameMenuElement._addToMenu(options.gui, menu, v.toString(), validate, invalidate);
        }
        return new SelectionMenuComponent(options.gui, name, parent, menu, SelectionMenuComponent.VERTICAL_LAYOUT);
    }
}
TOP

Related Classes of thegame.layers.options.FieldSlider

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.