List of usage examples for com.badlogic.gdx.scenes.scene2d.ui CheckBox CheckBox
public CheckBox(String text, CheckBoxStyle style)
From source file:Options.java
License:Apache License
public Options() { Sink.setBackground("title"); Sink.transitionDownToUp();//from w ww. j ava 2 s .c o m grid = new Table(); grid.setSize(Sink.targetWidth, Sink.targetHeight); grid.setFillParent(true); grid.setPosition(0, 0); grid.top().left(); grid.center(); float yoffset = Sink.targetHeight - 80; float xcenter = Sink.targetWidth / 2; /* ________________________ * |_______Options__________| * | | | * | | | * | | | * |__________|_____________| * |_________Back___________| */ TextButton title = new TextButton("Options", Asset.skin); title.setSize(200, 75); TextButton back = new TextButton("Back", Asset.skin); back.setSize(200, 75); back.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { super.clicked(event, x, y); Sink.setScene("Menu"); } }); CheckBox soundbtn = new CheckBox(" Sound ", Asset.skin); soundbtn.setChecked(Config.isSound); CheckBox musicbtn = new CheckBox(" Music ", Asset.skin); musicbtn.setChecked(Config.isMusic); CheckBox battbtn = new CheckBox(" Battle ", Asset.skin); battbtn.setChecked(Config.isBattleEnabled()); CheckBox semibtn = new CheckBox(" Semi-Auto ", Asset.skin); semibtn.setChecked(Config.isSemiAutomatic()); CheckBox panbtn = new CheckBox(" PanScroll ", Asset.skin); panbtn.setChecked(Config.usePan); CheckBox dragbtn = new CheckBox(" DragScroll ", Asset.skin); dragbtn.setChecked(Config.useDrag); CheckBox keybtn = new CheckBox(" UseKeyboard ", Asset.skin); keybtn.setChecked(Config.useKeyboard); Slider musicSlider = new Slider(0f, 1f, 0.1f, false, Asset.skin); Slider soundSlider = new Slider(0f, 1f, 0.1f, false, Asset.skin); Sink.addActor(title, xcenter - title.getWidth() + 30, yoffset); Sink.addActor(musicbtn, xcenter - musicbtn.getWidth(), yoffset - 60); Sink.addActor(musicSlider, xcenter + 30, yoffset - 60); Sink.addActor(soundbtn, xcenter - soundbtn.getWidth(), yoffset - 90); Sink.addActor(soundSlider, xcenter + 30, yoffset - 90); Sink.addActor(battbtn, xcenter - battbtn.getWidth(), yoffset - 120); Sink.addActor(panbtn, xcenter + 30, yoffset - 120); Sink.addActor(semibtn, xcenter - semibtn.getWidth(), yoffset - 150); Sink.addActor(dragbtn, xcenter + 30, yoffset - 150); Sink.addActor(dragbtn, xcenter + 30, yoffset - 180); Sink.addActor(back, xcenter - back.getWidth() + 30, 20); }
From source file:awakening.view.menu.Graphics.java
License:Apache License
/** * Constructor// w w w . ja v a2 s.com * * @param game Tower Awakening's Game * @param sound Main menu's music * @param effect Button's effect */ public Graphics(TAGame game, Music sound, Sound effect) { this.game = game; this.sound = sound; this.effect = effect; stage = new Stage(); try { if (game.getLanguage().equals("ENGLISH")) { language = ResourceBundle.getBundle("awakening.view.menu.res_en_EN", locales[0]); } else if (game.getLanguage().equals("FRENCH")) { language = ResourceBundle.getBundle("awakening.view.menu.res_fr_FR", locales[1]); } else if (game.getLanguage().equals("ITALIAN")) { language = ResourceBundle.getBundle("awakening.view.menu.res_it_IT", locales[2]); } else { language = ResourceBundle.getBundle("awakening.menu.res", locales[0]); } } catch (java.util.MissingResourceException e) { System.out.println("yolo"); } ///Viewport camera = new OrthographicCamera(); view = new StretchViewport(Gdx.app.getGraphics().getWidth(), Gdx.app.getGraphics().getWidth(), camera); ///Background background = new Texture(Gdx.files.internal("img/menu/Background-3.png")); batch = new SpriteBatch(); ///Skin skin = new Skin(Gdx.files.internal("uiskin.json")); ///Title title = new Label(language.getString("label_graphics_menu"), skin); ///Widgets Background widgetsBackground = new Image(new Texture(Gdx.files.internal("img/widget/bg widgets.png"))); ///Back Button btnBack = new TextButton(language.getString("button_back"), skin); ///CheckBox Fullscreen cbxFullscreen = new CheckBox(language.getString("label_fullscreen"), skin); ///SelectBox Resolution slbResolutions = new SelectBox<TAScreenSize>(skin); ///Label Resolution lblResolution = new Label(language.getString("label_resolution"), skin); }
From source file:be.ac.ucl.lfsab1509.bouboule.game.screen.AbstractScreen.java
License:Open Source License
protected CheckBox addCheckBox(String text, boolean bChecked, int x, int y) { CheckBox checkBox = new CheckBox(" " + text, getCheckBoxStyle()); checkBox.setX(x);/*from w ww. ja va 2s . c o m*/ checkBox.setY(y); checkBox.setChecked(bChecked); stage.addActor(checkBox); return checkBox; }
From source file:com.badlogic.gdx.spriter.demo.SpriterDemoApp.java
@Override public void create() { // Initialize object batch = new SpriteBatch(); camera = new OrthographicCamera(); FileHandleResolver resolver = new InternalFileHandleResolver(); assetManager = new AssetManager(resolver); assetManager.setLoader(SpriterData.class, new SpriterDataLoader(resolver)); resolver = new AbsoluteFileHandleResolver(); externalAssetManager = new AssetManager(resolver); externalAssetManager.setLoader(SpriterData.class, new SpriterDataLoader(resolver)); assetManager.load("uiskin.json", Skin.class); assetManager.finishLoading();//w w w. j a v a 2 s . co m skin = assetManager.get("uiskin.json"); // Create widgets stage = new Stage(new ScreenViewport(camera), batch); Label titleLabel = new Label("gdx-spriter", skin); titleLabel.setFontScale(3f); Label fpsLabel = new Label("FPS", skin) { @Override public void act(float delta) { this.setText(Gdx.graphics.getFramesPerSecond() + " FPS"); super.act(delta); } }; fileChooser = new SelectBox<SpriterDemoFileHandle>(skin); fileChooser.setName("Files"); fileChooser.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { changeSpriterFile(fileChooser.getSelected()); lastUsedSelectBox = fileChooser; } }); Button fileFinder = new TextButton("Browse", skin); fileFinder.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { FileDialog fileDialog = new FileDialog((java.awt.Frame) null, "Choose Spriter file", FileDialog.LOAD); fileDialog.setDirectory(lastFolderBrowsed); fileDialog.setResizable(true); fileDialog.setVisible(true); String file = fileDialog.getFile(); String directory = fileDialog.getDirectory(); if (directory != null) { lastFolderBrowsed = directory; } if (file != null) { String path = directory + file; addFile(Gdx.files.absolute(path), externalAssetManager); fileChooser.setItems(files); fileChooser.setSelectedIndex(fileChooser.getItems().size - 1); } } }); entityChooser = new SelectBox<SpriterAnimator>(skin); entityChooser.setName("Entities"); entityChooser.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { changeAnimator(entityChooser.getSelected()); lastUsedSelectBox = entityChooser; } }); animationChooser = new SelectBox<String>(skin); animationChooser.setName("Animations"); animationChooser.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { changeAnimation(animationChooser.getSelected()); lastUsedSelectBox = animationChooser; } }); final CheckBox transitionCheckbox = new CheckBox("Transition", skin); transitionCheckbox.setChecked(transition); transitionCheckbox.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { transition = transitionCheckbox.isChecked(); } }); charmapChooser = new List<SpriterCharacterMap>(skin); ArraySelection<SpriterCharacterMap> selection = charmapChooser.getSelection(); selection.setMultiple(true); selection.setRangeSelect(false); selection.setToggle(false); selection.setRequired(false); charmapChooser.setName("Charmaps"); charmapChooser.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { changeCharacterMaps(charmapChooser.getSelection().items().orderedItems()); } }); angleSlider = new SpriterDemoAnimatorSlider(0, 360, 1f, skin, "%.0f") { @Override public void setValue(SpriterAnimator animator, float value) { spriterAnimator.setRotation(value); } @Override protected float getValue(SpriterAnimator animator) { return spriterAnimator.getRotation(); } }; pivotXSlider = new SpriterDemoAnimatorSlider(-1000f, 1000f, 1f, skin, "%.0f") { @Override public void setValue(SpriterAnimator animator, float value) { animator.setPivotX(value); } @Override protected float getValue(SpriterAnimator animator) { return animator.getPivotX(); } }; pivotYSlider = new SpriterDemoAnimatorSlider(-1000f, 1000f, 1f, skin, "%.0f") { @Override public void setValue(SpriterAnimator animator, float value) { animator.setPivotY(value); } @Override protected float getValue(SpriterAnimator animator) { return animator.getPivotY(); } }; scaleXSlider = new SpriterDemoAnimatorSlider(-10f, 10f, 0.1f, skin) { @Override public void setValue(SpriterAnimator animator, float value) { spriterAnimator.setScaleX(value); } @Override protected float getValue(SpriterAnimator animator) { return spriterAnimator.getScaleX(); } }; scaleYSlider = new SpriterDemoAnimatorSlider(-10f, 10f, 0.1f, skin) { @Override public void setValue(SpriterAnimator animator, float value) { spriterAnimator.setScaleY(value); } @Override protected float getValue(SpriterAnimator animator) { return spriterAnimator.getScaleY(); } }; alphaSlider = new SpriterDemoAnimatorSlider(0f, 1f, 0.01f, skin, "%.2f") { @Override public void setValue(SpriterAnimator animator, float value) { animator.setAlpha(value); } @Override protected float getValue(SpriterAnimator animator) { return animator.getAlpha(); } }; speedSlider = new SpriterDemoAnimatorSlider(0f, 10f, 0.1f, skin) { @Override public void setValue(SpriterAnimator animator, float value) { animator.setSpeed(value); } @Override protected float getValue(SpriterAnimator animator) { return animator.getSpeed(); } }; allAnimatorSliders = new SpriterDemoAnimatorSlider[] { scaleXSlider, scaleYSlider, pivotXSlider, pivotYSlider, angleSlider, alphaSlider, speedSlider }; metaLabel = new Label("Meta: ", skin); metaLabel.setWrap(true); metaLabel.setAlignment(Align.topLeft); spriterPlaceholder = new Label("No animator", skin); spriterPlaceholder.setAlignment(Align.center); spriterAnimator = new SpriterAnimatorActor(animator); spriterAnimator.debug(); playPauseButton = new ImageButton(skin, "play"); playPauseButton.setChecked(true); playPauseButton.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { boolean playing = playPauseButton.isChecked(); spriterAnimator.setDisabled(!playing); } }); timeSlider = new Slider(0f, 2000f, 1, false, skin); timeSlider.addListener(timeSliderListener = new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { if (animator == null) return; animator.setTime(timeSlider.getValue()); animator.update(0f); } }); timeLabel = new Label("---", skin); // Put everything in place Table titleTable = new Table(skin); titleTable.add(titleLabel).pad(6f); titleTable.add().expandX(); titleTable.add(fpsLabel).padRight(10f); Table selectionTable = new Table(skin); selectionTable.defaults().pad(3f); Table filesTable = new Table(skin); filesTable.row(); filesTable.add(fileChooser).expand().fillX(); filesTable.add(fileFinder).padLeft(2f).padRight(1f); Table animationsTable = new Table(skin); animationsTable.row(); animationsTable.add(animationChooser).expand().fill(); animationsTable.add(transitionCheckbox).fillX().padLeft(2f); ScrollPane scrollableCharmapChooser = new ScrollPane(charmapChooser); Table menuTable = new Table(skin); menuTable.defaults().pad(3f).expandX().fillX(); menuTable.row(); menuTable.add(titleTable).colspan(2); menuTable.row(); menuTable.add("File"); menuTable.add(filesTable).pad(4f); menuTable.row(); menuTable.add("Entity"); menuTable.add(entityChooser).pad(4f); menuTable.row(); menuTable.add("Animation"); menuTable.add(animationsTable).pad(4f); menuTable.row(); menuTable.add("Maps"); menuTable.add(scrollableCharmapChooser).pad(4f); menuTable.row(); menuTable.add("Angle"); menuTable.add(angleSlider); menuTable.row(); menuTable.add("Pivot X"); menuTable.add(pivotXSlider); menuTable.row(); menuTable.add("Pivot Y"); menuTable.add(pivotYSlider); menuTable.row(); menuTable.add("Scale X"); menuTable.add(scaleXSlider); menuTable.row(); menuTable.add("Scale Y"); menuTable.add(scaleYSlider); menuTable.row(); menuTable.add("Alpha"); menuTable.add(alphaSlider); menuTable.row(); menuTable.add("Speed"); menuTable.add(speedSlider); menuTable.row(); menuTable.add().expandY(); Table contentTable = new Table(skin); contentTable.row(); contentTable.add(metaLabel).left().expandX().maxHeight(1f); contentTable.row(); contentTable.stack(spriterPlaceholder, spriterAnimator).expand(); Table timelineTable = new Table(skin); timelineTable.row(); timelineTable.add("Timeline").expandX().align(Align.bottom); timelineTable.row(); timelineTable.add(timeSlider).expandX().fillX(); timelineTable.row(); timelineTable.add(timeLabel).expandX().align(Align.top); Table controlTable = new Table(skin); controlTable.add(playPauseButton).space(5f).expandY().fillY(); controlTable.add(timelineTable).expandX().fillX(); rootTable = new Table(skin); rootTable.setFillParent(true); rootTable.row(); rootTable.add(menuTable).expandY().fill(); rootTable.add(contentTable).expand().fill(); rootTable.row(); rootTable.add(controlTable).colspan(2).expandX().fillX(); stage.addActor(rootTable); // Bring input processing to the party InputProcessor globalInput = new InputProcessor() { @Override public boolean keyDown(int keycode) { switch (keycode) { case Keys.UP: case Keys.Z: case Keys.W: if (lastUsedSelectBox != null) lastUsedSelectBox.setSelectedIndex(Math.max(lastUsedSelectBox.getSelectedIndex() - 1, 0)); break; case Keys.DOWN: case Keys.S: if (lastUsedSelectBox != null) lastUsedSelectBox.setSelectedIndex(Math.min(lastUsedSelectBox.getSelectedIndex() + 1, lastUsedSelectBox.getItems().size - 1)); break; default: break; } return true; } @Override public boolean keyUp(int keycode) { return false; } @Override public boolean keyTyped(char character) { return false; } @Override public boolean touchDown(int screenX, int screenY, int pointer, int button) { return false; } @Override public boolean touchUp(int screenX, int screenY, int pointer, int button) { return false; } @Override public boolean touchDragged(int screenX, int screenY, int pointer) { return false; } @Override public boolean mouseMoved(int screenX, int screenY) { return false; } @Override public boolean scrolled(int amount) { amount *= 0.05f; // Zoom coefficient scaleXSlider.setValue(scaleXSlider.getValue() + amount); scaleYSlider.setValue(scaleYSlider.getValue() + amount); return false; } }; Gdx.input.setInputProcessor(new InputMultiplexer(stage, globalInput)); // Add default test resources Array<String> testResources = new Array<String>(SpriterTestData.scml); testResources.addAll(SpriterTestData.scon); testResources.sort(); for (String path : testResources) addFile(Gdx.files.internal(path.replaceFirst("/", "")), assetManager); // Also go discover some unknown exotic resources! (won't work in jar though) Array<FileHandle> spriterFiles = SpriterDemoUtils.findFiles(new String[] { "scml", "scon" }); for (FileHandle f : spriterFiles) addFile(f, assetManager); fileChooser.setItems(files); lastUsedSelectBox = fileChooser; if (playPauseButton.isChecked()) animator.play(animator.getAnimations().iterator().next()); }
From source file:com.bitfire.postprocessing.demo.ResourceFactory.java
License:Apache License
public static CheckBox newCheckBox(String text, boolean checked, ClickListener listener) { CheckBox cb = new CheckBox(text, UISkin); cb.setChecked(checked);/*www . j av a 2 s .c o m*/ if (listener != null) { cb.addListener(listener); } return cb; }
From source file:com.bladecoder.engineeditor.scneditor.ViewWindow.java
License:Apache License
public ViewWindow(Skin skin, ScnWidget sw) { scnWidget = sw;/*from w ww . ja v a2s. c o m*/ Table table = new Table(skin); table.defaults().left().expandX(); table.top(); table.add(new Label("View", skin, "big")).center(); Drawable drawable = skin.getDrawable("trans"); setBackground(drawable); table.row(); final CheckBox inSceneCb = new CheckBox("Animations in scene", skin); inSceneCb.setChecked(false); table.add(inSceneCb); table.row(); final CheckBox animCb = new CheckBox("Show Animations", skin); animCb.setChecked(true); table.add(animCb); table.row(); walkZone = new CheckBox("Show Walkzone", skin); walkZone.setChecked(false); table.add(walkZone); setActor(table); inSceneCb.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, com.badlogic.gdx.scenes.scene2d.Actor actor) { scnWidget.setInSceneSprites(inSceneCb.isChecked()); } }); animCb.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, com.badlogic.gdx.scenes.scene2d.Actor actor) { scnWidget.setAnimation(animCb.isChecked()); } }); walkZone.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, com.badlogic.gdx.scenes.scene2d.Actor actor) { scnWidget.setShowWalkZone(walkZone.isChecked()); } }); prefSize(200, 200); setSize(200, 200); }
From source file:com.evoluzion.MenuInicio.java
License:Open Source License
public void controles() { if (stage == null) { //stage maneja elementos que reciben entradas como botones o eventos //en este caso se us apara los botones stage = new Stage(ancho, alto, true); stage.clear();/* ww w.jav a 2 s. c o m*/ Gdx.input.setInputProcessor(stage); //instansia los elemrntos de un boton //la posocion up y down usando imagenes y el texto que tiene cada uno TextButtonStyle estilo = new TextButtonStyle(); estilo.up = sk_skin.getDrawable("BotonUP"); estilo.down = sk_skin.getDrawable("BotonDown"); estilo.font = fu_fuente; //instancia los botones b_comenzar = new TextButton(tx.comenzar, estilo); b_comenzar.setWidth(200); b_comenzar.setHeight(30); b_comenzar.setX((ancho / 2) - b_comenzar.getWidth() / 2 + orX); b_comenzar.setY(50 + orY); b_Informacion = new TextButton(tx.sobreEvolizion, estilo); b_Informacion.setWidth(120); b_Informacion.setHeight(30); b_Informacion.setX(ancho - b_Informacion.getWidth() - 5); b_Informacion.setY(alto - b_Informacion.getHeight() - 5); b_Idioma = new TextButton(tx.idioma, estilo); b_Idioma.setWidth(120); b_Idioma.setHeight(30); b_Idioma.setX(ancho - b_Informacion.getWidth() - 125); b_Idioma.setY(alto - b_Informacion.getHeight() - 5); b_GuardarEn = new TextButton(tx.directorioTrabajo2, estilo); b_GuardarEn.setWidth(200); b_GuardarEn.setHeight(30); b_GuardarEn.setX((ancho / 2) - b_comenzar.getWidth() / 2 + orX); b_GuardarEn.setY(150 + orY); b_CargarP = new TextButton(tx.cargaPoblacion, estilo); b_CargarP.setWidth(200); b_CargarP.setHeight(30); b_CargarP.setX((ancho / 2) - b_comenzar.getWidth() / 2); b_CargarP.setY(100 + orY); b_salir = new TextButton(tx.salir, estilo); b_salir.setWidth(200); b_salir.setHeight(30); b_salir.setX((ancho / 2) - b_salir.getWidth() / 2 + orX); b_salir.setY(5 + orY); CheckBoxStyle checkBoxStyle = new CheckBoxStyle(); checkBoxStyle.checkboxOff = sk_skin2.getDrawable("boxN0"); checkBoxStyle.checkboxOn = sk_skin2.getDrawable("boxYES"); checkBoxStyle.font = fu_fuente; tfs_text = new TextFieldStyle(); tfs_text.background = sk_skin2.getDrawable("boxN0"); tfs_text.font = fu_fuente; tfs_text.fontColor = Color.BLACK; text = new TextField(tx.nombre, tfs_text); text.setSize(180, 25); text.setCursorPosition(0); text.setPosition(20 + orX, 450 + orY); text2 = new TextField("" + 60, tfs_text); text2.setSize(38, 20); text2.setCursorPosition(0); text2.setPosition(660 + orX, 310 + orY); text3 = new TextField("" + 0, tfs_text); text3.setSize(38, 20); text3.setCursorPosition(0); text3.setPosition(660 + orX, 280 + orY); tf_ATB = new TextField("" + 0, tfs_text); tf_ATB.setSize(38, 20); tf_ATB.setCursorPosition(0); tf_ATB.setPosition(660 + orX, 250 + orY); text4 = new TextField("" + 0, tfs_text); text4.setSize(38, 20); text4.setCursorPosition(0); text4.setPosition(660 + orX, 220 + orY); tf_energia = new TextField("20", tfs_text); tf_energia.setSize(30, 20); tf_energia.setCursorPosition(0); tf_energia.setPosition(420 + orX, 310 + orY); tf_biomasa = new TextField("20", tfs_text); tf_biomasa.setSize(30, 20); tf_biomasa.setCursorPosition(0); tf_biomasa.setPosition(420 + orX, 280 + orY); tf_Numenergia = new TextField("800", tfs_text); tf_Numenergia.setSize(40, 20); tf_Numenergia.setCursorPosition(0); tf_Numenergia.setPosition(420 + orX, 250 + orY); tf_Numbiomasa = new TextField("800", tfs_text); tf_Numbiomasa.setSize(40, 20); tf_Numbiomasa.setCursorPosition(0); tf_Numbiomasa.setPosition(420 + orX, 220 + orY); tf_Cantidad = new TextField("1", tfs_text); tf_Cantidad.setSize(38, 20); tf_Cantidad.setCursorPosition(0); tf_Cantidad.setPosition(660 + orX, 190 + orY); tf_CantidadMax = new TextField("1000", tfs_text); tf_CantidadMax.setSize(38, 20); tf_CantidadMax.setCursorPosition(0); tf_CantidadMax.setPosition(660 + orX, 160 + orY); cb_moverMasa = new CheckBox(tx.moverLaMasa, checkBoxStyle); cb_moverMasa.getCells().get(0).size(20, 20); cb_moverMasa.setChecked(true); cb_moverMasa.setPosition(637 + orX, 105 + orY); tf_Temperatura = new TextField("25", tfs_text); tf_Temperatura.setSize(38, 20); tf_Temperatura.setCursorPosition(0); tf_Temperatura.setPosition(660 + orX, 90 + orY); tf_Start1 = new TextField("0", tfs_text); tf_Start1.setSize(60, 20); tf_Start1.setCursorPosition(0); tf_Start1.setPosition(675 + orX, 10 + orY); tf_TempFinal1 = new TextField("0", tfs_text); tf_TempFinal1.setSize(60, 20); tf_TempFinal1.setCursorPosition(0); tf_TempFinal1.setPosition(780 + orX, 10 + orY); tf_DeltaTiempo1 = new TextField("0", tfs_text); tf_DeltaTiempo1.setSize(60, 20); tf_DeltaTiempo1.setCursorPosition(0); tf_DeltaTiempo1.setPosition(895 + orX, 10 + orY); tf_Start2 = new TextField("0", tfs_text); tf_Start2.setSize(60, 20); tf_Start2.setCursorPosition(0); tf_Start2.setPosition(675 + orX, -20 + orY); tf_TempFinal2 = new TextField("0", tfs_text); tf_TempFinal2.setSize(60, 20); tf_TempFinal2.setCursorPosition(0); tf_TempFinal2.setPosition(780 + orX, -20 + orY); tf_DeltaTiempo2 = new TextField("0", tfs_text); tf_DeltaTiempo2.setSize(60, 20); tf_DeltaTiempo2.setCursorPosition(0); tf_DeltaTiempo2.setPosition(895 + orX, -20 + orY); cb_leerPoblacion = new CheckBox(tx.cargarArchivo, checkBoxStyle); cb_leerPoblacion.getCells().get(0).size(15, 15); cb_leerPoblacion.setChecked(false); cb_leerPoblacion.setPosition(0 + orX, 380 + orY); cb_mutar = new CheckBox(tx.color, checkBoxStyle); cb_mutar.getCells().get(0).size(20, 20); cb_mutar.setChecked(true); cb_mutar.setPosition(20 + orX, 305 + orY); cb_mutarSize = new CheckBox(tx.tamano, checkBoxStyle); cb_mutarSize.getCells().get(0).size(20, 20); cb_mutarSize.setChecked(true); cb_mutarSize.setPosition(20 + orX, 280 + orY); cb_mutarSpeed = new CheckBox(tx.velocidad, checkBoxStyle); cb_mutarSpeed.getCells().get(0).size(20, 20); cb_mutarSpeed.setChecked(true); cb_mutarSpeed.setPosition(20 + orX, 255 + orY); cb_mutarSentir = new CheckBox(tx.sentidos, checkBoxStyle); cb_mutarSentir.getCells().get(0).size(20, 20); cb_mutarSentir.setChecked(true); cb_mutarSentir.setPosition(20 + orX, 230 + orY); cb_mutarCazar = new CheckBox(tx.buscarComida, checkBoxStyle); cb_mutarCazar.getCells().get(0).size(20, 20); cb_mutarCazar.setChecked(true); cb_mutarCazar.setPosition(200 + orX, 305 + orY); cb_mutarEscapar = new CheckBox(tx.escapar, checkBoxStyle); cb_mutarEscapar.getCells().get(0).size(20, 20); cb_mutarEscapar.setChecked(true); cb_mutarEscapar.setPosition(200 + orX, 280 + orY); cb_mutarRadioCon = new CheckBox(tx.alcanceVisual, checkBoxStyle); cb_mutarRadioCon.getCells().get(0).size(20, 20); cb_mutarRadioCon.setChecked(true); cb_mutarRadioCon.setPosition(200 + orX, 255 + orY); cb_mutarPredador = new CheckBox(tx.genPredador, checkBoxStyle); cb_mutarPredador.getCells().get(0).size(20, 20); cb_mutarPredador.setChecked(true); cb_mutarPredador.setPosition(200 + orX, 230 + orY); cb_mutarTasaMut = new CheckBox("Fidelidad ADNpol", checkBoxStyle); cb_mutarTasaMut.getCells().get(0).size(20, 20); cb_mutarTasaMut.setChecked(true); cb_mutarTasaMut.setPosition(20 + orX, 205 + orY); cb_mutarLongevidad = new CheckBox(tx.longevidad, checkBoxStyle); cb_mutarLongevidad.getCells().get(0).size(20, 20); cb_mutarLongevidad.setChecked(true); cb_mutarLongevidad.setPosition(200 + orX, 205 + orY); cb_mutartolerancia = new CheckBox(tx.temOptima, checkBoxStyle); cb_mutartolerancia.getCells().get(0).size(20, 20); cb_mutartolerancia.setChecked(true); cb_mutartolerancia.setPosition(20 + orX, 180 + orY); cb_mutarResistencia = new CheckBox(tx.ResATB, checkBoxStyle); cb_mutarResistencia.getCells().get(0).size(20, 20); cb_mutarResistencia.setChecked(true); cb_mutarResistencia.setPosition(200 + orX, 180 + orY); cb_colectarColor = new CheckBox(tx.color, checkBoxStyle); cb_colectarColor.getCells().get(0).size(20, 20); cb_colectarColor.setChecked(true); cb_colectarColor.setPosition(20 + orX, 125 + orY); cb_colectarSize = new CheckBox(tx.tamano, checkBoxStyle); cb_colectarSize.getCells().get(0).size(20, 20); cb_colectarSize.setChecked(true); cb_colectarSize.setPosition(20 + orX, 100 + orY); cb_colectarSpeed = new CheckBox(tx.velocidad, checkBoxStyle); cb_colectarSpeed.getCells().get(0).size(20, 20); cb_colectarSpeed.setChecked(false); cb_colectarSpeed.setPosition(20 + orX, 75 + orY); cb_colectarSentir = new CheckBox(tx.sentidos, checkBoxStyle); cb_colectarSentir.getCells().get(0).size(20, 20); cb_colectarSentir.setChecked(false); cb_colectarSentir.setPosition(20 + orX, 50 + orY); cb_colectarCazar = new CheckBox(tx.buscarComida, checkBoxStyle); cb_colectarCazar.getCells().get(0).size(20, 20); cb_colectarCazar.setChecked(false); cb_colectarCazar.setPosition(200 + orX, 125 + orY); cb_colectarEscapar = new CheckBox(tx.escapar, checkBoxStyle); cb_colectarEscapar.getCells().get(0).size(20, 20); cb_colectarEscapar.setChecked(false); cb_colectarEscapar.setPosition(200 + orX, 100 + orY); cb_colectarRadioCon = new CheckBox(tx.alcanceVisual, checkBoxStyle); cb_colectarRadioCon.getCells().get(0).size(20, 20); cb_colectarRadioCon.setChecked(false); cb_colectarRadioCon.setPosition(200 + orX, 75 + orY); cb_colectarPredador = new CheckBox(tx.genPredador, checkBoxStyle); cb_colectarPredador.getCells().get(0).size(20, 20); cb_colectarPredador.setChecked(false); cb_colectarPredador.setPosition(200 + orX, 50 + orY); cb_colectarTasaMut = new CheckBox(tx.fidelidadADNpol, checkBoxStyle); cb_colectarTasaMut.getCells().get(0).size(20, 20); cb_colectarTasaMut.setChecked(false); cb_colectarTasaMut.setPosition(20 + orX, 25 + orY); cb_colectarLongevidad = new CheckBox(tx.longevidad, checkBoxStyle); cb_colectarLongevidad.getCells().get(0).size(20, 20); cb_colectarLongevidad.setChecked(false); cb_colectarLongevidad.setPosition(200 + orX, 25 + orY); cb_colectarTolerancia = new CheckBox(tx.temOptima, checkBoxStyle); cb_colectarTolerancia.getCells().get(0).size(20, 20); cb_colectarTolerancia.setChecked(false); cb_colectarTolerancia.setPosition(20 + orX, 0 + orY); cb_colectarResistencia = new CheckBox(tx.ResATB, checkBoxStyle); cb_colectarResistencia.getCells().get(0).size(20, 20); cb_colectarResistencia.setChecked(false); cb_colectarResistencia.setPosition(200 + orX, 0 + orY); tf_MultiploPol = new TextField("1.0", tfs_text); tf_MultiploPol.setSize(40, 20); tf_MultiploPol.setCursorPosition(0); tf_MultiploPol.setPosition(20 + orX, -30 + orY); tf_HorizontalTransfer = new TextField("500000", tfs_text); tf_HorizontalTransfer.setSize(80, 20); tf_HorizontalTransfer.setCursorPosition(0); tf_HorizontalTransfer.setPosition(35 + orX, -60 + orY); //se agregan los listener para los botones stage.addActor(b_Informacion); stage.addActor(b_Idioma); stage.addActor(b_salir); stage.addActor(b_GuardarEn); stage.addActor(b_comenzar); stage.addActor(b_CargarP); stage.addActor(cb_mutar); stage.addActor(cb_mutarSize); stage.addActor(cb_mutarSpeed); stage.addActor(cb_mutarSentir); stage.addActor(cb_mutarPredador); stage.addActor(cb_mutarCazar); stage.addActor(cb_mutarEscapar); stage.addActor(cb_mutarRadioCon); stage.addActor(cb_mutarPredador); stage.addActor(cb_mutarLongevidad); stage.addActor(cb_mutarTasaMut); stage.addActor(cb_mutartolerancia); stage.addActor(cb_mutarResistencia); stage.addActor(cb_colectarColor); stage.addActor(cb_colectarSize); stage.addActor(cb_colectarSpeed); stage.addActor(cb_colectarSentir); stage.addActor(cb_colectarCazar); stage.addActor(cb_colectarEscapar); stage.addActor(cb_colectarRadioCon); stage.addActor(cb_colectarPredador); stage.addActor(cb_colectarTasaMut); stage.addActor(cb_colectarLongevidad); stage.addActor(cb_colectarTolerancia); stage.addActor(cb_colectarResistencia); stage.addActor(cb_leerPoblacion); stage.addActor(cb_moverMasa); stage.addActor(text); stage.addActor(text2); stage.addActor(text3); stage.addActor(text4); stage.addActor(tf_ATB); stage.addActor(tf_energia); stage.addActor(tf_biomasa); stage.addActor(tf_Numenergia); stage.addActor(tf_Numbiomasa); stage.addActor(tf_Cantidad); stage.addActor(tf_CantidadMax); stage.addActor(tf_Temperatura); stage.addActor(tf_Start1); stage.addActor(tf_Start2); stage.addActor(tf_TempFinal1); stage.addActor(tf_TempFinal2); stage.addActor(tf_DeltaTiempo1); stage.addActor(tf_DeltaTiempo2); stage.addActor(tf_MultiploPol); stage.addActor(tf_HorizontalTransfer); b_Informacion.addListener(new InputListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { // JFrame jf = new JFrame(); // jf.setVisible(true); // jf.setLocation(500, 500); // jf.setAlwaysOnTop(true); JOptionPane.showMessageDialog(null, tx.mensajeSobre); //jf.dispose(); return true; } public void touchUp(InputEvent event, float x, float y, int pointer, int button) { } }); b_Idioma.addListener(new InputListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { ingles = ingles * (-1); if (ingles == 1) { tx.setIngles(); } if (ingles == -1) { tx.setEspanol(); } JOptionPane.showMessageDialog(null, tx.losCambiosReiniciar); escribirIdioma(); return true; } public void touchUp(InputEvent event, float x, float y, int pointer, int button) { } }); b_GuardarEn.addListener(new InputListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { //Agrega Filtro para ver tipos de archivo JFileChooser fc = new JFileChooser(); fc.setCurrentDirectory(new File("./")); fc.setDialogTitle(tx.agregarDespues); fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = fc.showSaveDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { ruta = fc.getCurrentDirectory().getAbsolutePath() + "/"; } escribirRuta(); return true; } public void touchUp(InputEvent event, float x, float y, int pointer, int button) { } }); b_CargarP.addListener(new InputListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { //Agrega Filtro para ver tipos de archivo JFileChooser fc = new JFileChooser(); fc.setCurrentDirectory(new File("ruta")); FileNameExtensionFilter filter = new FileNameExtensionFilter(tx.poblacion + " (pob)", "pob"); fc.setFileFilter(filter); fc.setDialogTitle(tx.directorio); fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); int returnVal = fc.showOpenDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { poblacion = fc.getSelectedFile().getAbsolutePath(); cb_leerPoblacion.setChecked(true); } return true; } public void touchUp(InputEvent event, float x, float y, int pointer, int button) { } }); b_salir.addListener(new InputListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { return true; } public void touchUp(InputEvent event, float x, float y, int pointer, int button) { // JFrame jf = new JFrame(); // jf.setVisible(true); // jf.setLocation(500, 500); // jf.setAlwaysOnTop(true); Object[] options = { tx.si, tx.no }; int n = JOptionPane.showOptionDialog(null, tx.deseaSalir, "", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE, null, options, options[1]); if (n == JOptionPane.YES_OPTION) { System.exit(0); } //jf.dispose(); } }); b_comenzar.addListener(new InputListener() { private int tiempoCatastrofe; int tiempoATB; private int tiempoMaximo; private int numOrgMax; private float Temperatura; private int Start1; private int Start2; private float TempFinal1; private float TempFinal2; private int DeltaTiempo1; private int DeltaTiempo2; private float eficiencia; private int horizontalTransferRate; public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { guardarMenuInicio(); try { Senergia = Integer.parseInt(tf_energia.getText()); Qbiomasa = Integer.parseInt(tf_biomasa.getText()); numSen = Integer.parseInt(tf_Numenergia.getText()); numQen = Integer.parseInt(tf_Numbiomasa.getText()); tiempoMuestreo = Integer.parseInt(text2.getText()); tiempoCatastrofe = Integer.parseInt(text3.getText()); tiempoATB = Integer.parseInt(tf_ATB.getText()); tiempoMaximo = Integer.parseInt(text4.getText()); numOrg = Integer.parseInt(tf_Cantidad.getText()); numOrgMax = Integer.parseInt(tf_CantidadMax.getText()); Temperatura = Float.parseFloat(tf_Temperatura.getText()); Start1 = Integer.parseInt(tf_Start1.getText()); Start2 = Integer.parseInt(tf_Start2.getText()); TempFinal1 = Float.parseFloat(tf_TempFinal1.getText()); TempFinal2 = Float.parseFloat(tf_TempFinal2.getText()); DeltaTiempo1 = Integer.parseInt(tf_DeltaTiempo1.getText()); DeltaTiempo2 = Integer.parseInt(tf_DeltaTiempo2.getText()); eficiencia = Float.parseFloat(tf_MultiploPol.getText()); horizontalTransferRate = Integer.parseInt(tf_HorizontalTransfer.getText()); } catch (NumberFormatException e) { Senergia = 20; Qbiomasa = 20; numSen = 800; numQen = 800; tiempoMuestreo = 60; tiempoCatastrofe = 0; tiempoATB = 0; tiempoMaximo = 0; numOrg = 1; numOrgMax = 1000; Temperatura = 0; Start1 = 0; Start2 = 0; TempFinal1 = 0; TempFinal2 = 0; DeltaTiempo1 = 0; DeltaTiempo2 = 0; eficiencia = 1; horizontalTransferRate = 5000000; e.printStackTrace(); } m = new Mundo(ev, ruta, text.getText(), poblacion, numOrg, numSen, numQen, Senergia, Qbiomasa, cb_leerPoblacion.isChecked(), cb_moverMasa.isChecked(), genesPedidos().toString(), ingles); m.tiempoMuestreo = tiempoMuestreo; m.tiempoCatastrofe = tiempoCatastrofe; m.tiempoATB = tiempoATB; m.tiempoMaximo = tiempoMaximo; m.maximo = numOrgMax; m.temperatura = Temperatura; m.minStar1 = Start1; m.minStar2 = Start2; m.deltaTime1 = DeltaTiempo1; m.deltaTime2 = DeltaTiempo2; m.TempFinal1 = TempFinal1; m.TempFinal2 = TempFinal2; m.eficiencia = eficiencia; m.horizontalTransferRate = horizontalTransferRate; if (DeltaTiempo1 != 0) { m.tempXSecond1 = (TempFinal1 - Temperatura) / (DeltaTiempo1 * 60); } if (DeltaTiempo2 != 0) { m.tempXSecond2 = (TempFinal2 - TempFinal1) / (DeltaTiempo2 * 60); } m.colectarancho = cb_colectarSize.isChecked(); m.colectaralto = cb_colectarSize.isChecked(); m.colectSpeed = cb_colectarSpeed.isChecked(); m.colectColor = cb_colectarColor.isChecked(); m.colectSentir = cb_colectarSentir.isChecked(); m.colectCazar = cb_colectarCazar.isChecked(); m.colectEscapar = cb_colectarEscapar.isChecked(); m.colectPredador = cb_colectarPredador.isChecked(); m.colectarLongevidad = cb_colectarLongevidad.isChecked(); m.colectarTasaMut = cb_colectarTasaMut.isChecked(); m.colectarTemp = cb_colectarTolerancia.isChecked(); m.colectarResistencia = cb_colectarResistencia.isChecked(); m.mutarColor = cb_mutar.isChecked(); m.mutarSize = cb_mutarSize.isChecked(); m.mutarSpeed = cb_mutarSpeed.isChecked(); m.mutarSentir = cb_mutarSentir.isChecked(); m.mutarPredador = cb_mutarPredador.isChecked(); m.mutarCazar = cb_mutarCazar.isChecked(); m.mutarEscapar = cb_mutarEscapar.isChecked(); m.mutarRadioconsiente = cb_mutarRadioCon.isChecked(); m.mutarLongevidad = cb_mutarLongevidad.isChecked(); m.mutarTasaMut = cb_mutarTasaMut.isChecked(); m.mutarTemp = cb_mutartolerancia.isChecked(); m.mutarResistencia = cb_mutarResistencia.isChecked(); if (cb_leerPoblacion.isChecked() == false) { m.agregarPrimerosOrg(numOrg); } if (cb_leerPoblacion.isChecked() == true) { m.leerArchivoPoblacion(); } m.setDelta(); m.setDelta2(); m.setDelta3(); m.setTiempo(); m.segundos = 0; m.segundos2 = 0; m.segundos3 = 0; m.segundos4 = 0; m.segundos5 = 0; m.colectorEspesiesTotales(); m.f_genes.creararchivo(ruta + m.nombre + tx.genomasTXT); m.f_genes.escribirArchivo(tx.cuandoEstenPresentes + genesPedidos().toString() + "\n"); m.f_datos.creararchivo(ruta + m.nombre + tx.datosXls); m.f_datos.escribirArchivo(tx.datosOrdenados); m.f_proteoma.creararchivo(ruta + m.nombre + tx.proteomaTXT); m.f_proteoma.escribirArchivo(tx.cuandoEstenPresntesProt + genesPedidos().toString() + "\n"); m.f_mutantes.creararchivo(ruta + m.nombre + tx.mutantesXLS); StringBuffer linea = new StringBuffer(tx.tiempo + "," + tx.nombre + "," + tx.cantidad + ""); if (cb_colectarSize.isChecked()) { linea.append(", " + tx.alto); } if (cb_colectarSize.isChecked()) { linea.append(", " + tx.ancho); } if (cb_colectarSpeed.isChecked()) { linea.append(", " + tx.velocidad); } if (cb_colectarColor.isChecked()) { linea.append(", " + tx.color); } if (cb_colectarTasaMut.isChecked()) { linea.append(", " + tx.fidelidadADNpol); } if (cb_colectarTolerancia.isChecked()) { linea.append(", " + tx.temOptima); } if (cb_colectarLongevidad.isChecked()) { linea.append(", " + tx.longevidad); } if (cb_colectarRadioCon.isChecked()) { linea.append(", " + tx.alcanceVisual); } if (cb_colectarPredador.isChecked()) { linea.append(", " + tx.genPredador); } if (cb_colectarSentir.isChecked()) { linea.append(", " + tx.sentidos); } if (cb_colectarCazar.isChecked()) { linea.append(", " + tx.buscarComida); } if (cb_colectarEscapar.isChecked()) { linea.append(", " + tx.escapar); } if (cb_colectarResistencia.isChecked()) { linea.append(", " + tx.resistensiaATB); } linea.append("\n"); m.f_mutantes.escribirArchivo(linea.toString()); m.f_arbol.creararchivo(ruta + m.nombre + tx.arbolTXT); // System.out.println(m.segundos); m.colectorEspesies(); m.guardarDatos(); m.archivarGenoma(); m.archivarFenotipo(); m.archivarProteoma(); ev.setScreen(new Pantalla(ev, m)); dispose(); return true; } public void touchUp(InputEvent event, float x, float y, int pointer, int button) { } }); } //leerMenuIncio(); }
From source file:com.evoluzion.Pantalla.java
License:Open Source License
@Override public void resize(int width, int height) { if (stage == null) { //stage maneja elementos que reciben entradas como botones o eventos //en este caso se us apara los botones stage = new Stage(width, height, true); stage.clear();/*w w w . j a v a 2 s.co m*/ Gdx.input.setInputProcessor(stage); //instansia los elemrntos de un boton //la posocion up y down usando imagenes y el texto que tiene cada uno TextButtonStyle estilo = new TextButtonStyle(); estilo.up = sk_skin.getDrawable("BotonUP"); estilo.down = sk_skin.getDrawable("BotonDown"); estilo.font = fu_fuente; //instancia los botones b_Salir = new TextButton(tx.guardarYcerrar, estilo); b_Salir.setWidth(150); b_Salir.setHeight(20); b_Salir.setX(m.ancho - 142); b_Salir.setY(m.alto - 20); b_pausa = new TextButton(tx.playPausa, estilo); b_pausa.setWidth(150); b_pausa.setHeight(20); b_pausa.setX(m.ancho - 284); b_pausa.setY(m.alto - 20); b_verOcultar = new TextButton(tx.verOcultar, estilo); b_verOcultar.setWidth(140); b_verOcultar.setHeight(20); b_verOcultar.setX(0); b_verOcultar.setY(m.alto - 20); b_guardar = new TextButton(tx.menuGuardar, estilo); b_guardar.setWidth(140); b_guardar.setHeight(20); b_guardar.setX(142); b_guardar.setY(m.alto - 20); b_colectar = new TextButton(tx.tomarMuestra, estilo); b_colectar.setWidth(140); b_colectar.setHeight(20); b_colectar.setX(200); b_colectar.setY(m.alto - 42); b_colectarP = new TextButton(tx.guardarTodos, estilo); b_colectarP.setWidth(140); b_colectarP.setHeight(20); b_colectarP.setX(200); b_colectarP.setY(m.alto - 65); b_colectarPM = new TextButton(tx.guardarMarcados, estilo); b_colectarPM.setWidth(140); b_colectarPM.setHeight(20); b_colectarPM.setX(200); b_colectarPM.setY(m.alto - 88); b_colectarPnM = new TextButton(tx.guardarNoMarcados, estilo); b_colectarPnM.setWidth(140); b_colectarPnM.setHeight(20); b_colectarPnM.setX(200); b_colectarPnM.setY(m.alto - 111); b_marcarTodo = new TextButton(tx.marcarDesmarcar, estilo); b_marcarTodo.setWidth(140); b_marcarTodo.setHeight(20); b_marcarTodo.setX(284); b_marcarTodo.setY(m.alto - 20); b_antibiotico = new TextButton(tx.antibiotico, estilo); b_antibiotico.setWidth(140); b_antibiotico.setHeight(20); b_antibiotico.setX(428); b_antibiotico.setY(m.alto - 20); b_catastrofe = new TextButton(tx.catastrofe, estilo); b_catastrofe.setWidth(140); b_catastrofe.setHeight(20); b_catastrofe.setX(570); b_catastrofe.setY(m.alto - 20); CheckBoxStyle checkBoxStyle = new CheckBoxStyle(); checkBoxStyle.checkboxOff = sk_skin2.getDrawable("boxN0"); checkBoxStyle.checkboxOn = sk_skin2.getDrawable("boxYES"); checkBoxStyle.font = fu_fuente; cb_verEnergia = new CheckBox(tx.verEnergia, checkBoxStyle); cb_verEnergia.getCells().get(0).size(20, 20); cb_verEnergia.setChecked(true); cb_verEnergia.setPosition(-10, 320); cb_verMasa = new CheckBox(tx.verMasa, checkBoxStyle); cb_verMasa.getCells().get(0).size(20, 20); cb_verMasa.setChecked(true); cb_verMasa.setPosition(-10, 380); cb_verOrganismos = new CheckBox(tx.verOrgansimo, checkBoxStyle); cb_verOrganismos.getCells().get(0).size(20, 20); cb_verOrganismos.setChecked(true); cb_verOrganismos.setPosition(-10, 350); stage.addActor(b_Salir); stage.addActor(b_pausa); stage.addActor(b_verOcultar); stage.addActor(b_guardar); stage.addActor(b_colectar); stage.addActor(b_colectarP); stage.addActor(b_colectarPM); stage.addActor(b_colectarPnM); stage.addActor(b_marcarTodo); stage.addActor(b_catastrofe); stage.addActor(cb_verEnergia); stage.addActor(cb_verMasa); stage.addActor(cb_verOrganismos); stage.addActor(b_antibiotico); //se agregan los listener para los botones b_Salir.addListener(new InputListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { m.pausaGame = m.pausaGame * (-1); Object[] options = { tx.si, tx.no }; int n = JOptionPane.showOptionDialog(null, tx.terminarGuardarMensaje, "", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE, null, options, options[1]); if (n == JOptionPane.YES_OPTION) { if (todoGuardado == false) { if (m.aorg.size > 0) { m.guardarDatos(); m.archivarGenoma(); m.archivarProteoma(); } m.f_genes.cerrarArchivo(); m.f_proteoma.cerrarArchivo(); m.f_mutantes.cerrarArchivo(); m.f_datos.cerrarArchivo(); m.archivaTodaslasEspecies(); } ev.setScreen(new MenuInicio(ev)); // m = null; dispose(); } if (n == JOptionPane.NO_OPTION) { } return true; } public void touchUp(InputEvent event, float x, float y, int pointer, int button) { } }); b_pausa.addListener(new InputListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { m.pausaGame = m.pausaGame * (-1); return true; } public void touchUp(InputEvent event, float x, float y, int pointer, int button) { } }); b_verOcultar.addListener(new InputListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { verPanel = verPanel * (-1); return true; } public void touchUp(InputEvent event, float x, float y, int pointer, int button) { } }); b_guardar.addListener(new InputListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { verBotones1 = verBotones1 / 2; verBotones1 = verBotones1 * (-1); return true; } public void touchUp(InputEvent event, float x, float y, int pointer, int button) { } }); b_colectar.addListener(new InputListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { m.colectorEspesies(); m.guardarDatos(); m.archivarGenoma(); m.archivarProteoma(); m.archivarFenotipo(); return true; } public void touchUp(InputEvent event, float x, float y, int pointer, int button) { verBotones1 = verBotones1 / 2; verBotones1 = verBotones1 * (-1); } }); b_colectarP.addListener(new InputListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { m.pausaGame = -1; m.guardarPoblacion(); // return true; } public void touchUp(InputEvent event, float x, float y, int pointer, int button) { verBotones1 = verBotones1 / 2; verBotones1 = verBotones1 * (-1); // m.pausaGame= 1; } }); b_colectarPM.addListener(new InputListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { m.pausaGame = -1; m.guardarPoblacionMarcada(); // return true; } public void touchUp(InputEvent event, float x, float y, int pointer, int button) { verBotones1 = verBotones1 / 2; verBotones1 = verBotones1 * (-1); // m.pausaGame= 1; } }); b_colectarPnM.addListener(new InputListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { m.pausaGame = -1; m.guardarPoblacionNoMaracada(); // return true; } public void touchUp(InputEvent event, float x, float y, int pointer, int button) { verBotones1 = verBotones1 / 2; verBotones1 = verBotones1 * (-1); // m.pausaGame= 1; } }); b_marcarTodo.addListener(new InputListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { int size = m.aorg.size; for (int i = size - 1; i >= 0; i--) { m.aorg.get(i).marcado = m.aorg.get(i).marcado * (-1); } return true; } public void touchUp(InputEvent event, float x, float y, int pointer, int button) { } }); b_antibiotico.addListener(new InputListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { m.antibiotico = m.antibiotico * (-1); return true; } public void touchUp(InputEvent event, float x, float y, int pointer, int button) { } }); b_catastrofe.addListener(new InputListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { m.catastrofe(); return true; } public void touchUp(InputEvent event, float x, float y, int pointer, int button) { } }); } }
From source file:com.forerunnergames.peril.client.ui.widgets.AbstractWidgetFactory.java
License:Open Source License
@Override public final CheckBox createCheckBox(final CheckBox.CheckBoxStyle style, final EventListener listener) { Arguments.checkIsNotNull(style, "style"); Arguments.checkIsNotNull(listener, "listener"); final CheckBox checkBox = new CheckBox("", style); checkBox.addListener(listener);//from www . j a v a 2 s. c o m return checkBox; }
From source file:com.jmstudios.pointandhit.OptionsScreen.java
License:Open Source License
private CheckBox newRadioButton(String text) { CheckBox radioButton = new CheckBox(text, checkBoxStyle); radioButton.getImageCell().pad(20 * scale); radioButton.getImageCell().size(radioButton.getImageCell().getPrefWidth() * scale); return radioButton; }