Package com.drakulo.games.ais.ui.component.button

Examples of com.drakulo.games.ais.ui.component.button.TextButton


  public GameMenu() {
    super(132, 150);

    final int btnSize = 120;
   
    this.optionButton = new TextButton(I18n.get("global.options"));
    this.optionButton.disable();
    this.optionButton.setWidth(btnSize);
   
    this.loadButton = new TextButton(I18n.get("global.load"));
    this.loadButton.disable();
    this.loadButton.setWidth(btnSize);
   
    this.saveButton = new TextButton(I18n.get("global.save"));
    this.saveButton.disable();
    this.saveButton.setWidth(btnSize);
   
    this.exitButton = new TextButton(I18n.get("global.exit"));
    this.exitButton.setWidth(btnSize);

    // Positionning buttons
    int y = this.getOY() + 5;
    final int pitch = Button.DEFAULT_HEIGHT + 10;
View Full Code Here


    });

    int width = TOP_BAR_WIDTH + TOGGLE_BUTTON_ZONE_WIDTH;
    x = Settings.WIDTH / 2 - width / 2 + 4;
    y = PADDING + 3;
    final TextButton resourceTogglerButton = new TextButton("+");
    resourceTogglerButton.setPosition(x, y);
    resourceTogglerButton.setSize(21, 21);
    resourceTogglerButton.setActionHandler(new ActionHandler() {

      @Override
      public void run() {
        SectorState.this.extendedResourceDisplay = !SectorState.this.extendedResourceDisplay;
        Resource[] resources = Resource.values();
        for (Resource r : resources) {
          boolean show = SectorState.this.extendedResourceDisplay;
          SectorState.this.inStoreLabels.get(r).setVisible(show);
          SectorState.this.maxStoreLabels.get(r).setVisible(show);
          SectorState.this.availableSpaceLabels.get(r).setVisible(
              show);
          SectorState.this.modifiersLabels.get(r).setVisible(show);
          SectorState.this.storeTitle.setVisible(show);
          SectorState.this.maxStoreTitle.setVisible(show);
          SectorState.this.availableSpaceTitle.setVisible(show);
          SectorState.this.modifierTitle.setVisible(show);

          if (show) {
            resourceTogglerButton.setText("-");
          } else {
            resourceTogglerButton.setText("+");
          }
        }
      }
    });
    add(resourceTogglerButton);
View Full Code Here

    setSize(width, height);
    final int buttonX = this.getOX() + this.width / 2
        - Button.DEFAULT_WIDTH / 2;
    final int buttonY = this.getOY() + this.height - Button.DEFAULT_HEIGHT
        - 5;
    this.closeButton = new TextButton(I18n.get("global.close"), buttonX, buttonY);
    this.closeButton.setActionHandler(new ActionHandler() {

      @Override
      public void run() {
        hide();
View Full Code Here

    int y = screenPadding;
    String label;

    // Button for open the game menu
    label = FontHelper.firstToUpper(I18n.get("global.game_menu"));
    TextButton gameMenuButton = new TextButton(label, x, y);
    gameMenuButton.setSize(buttonWidth, buttonHeight);
    gameMenuButton.setActionHandler(new ActionHandler() {

      @Override
      public void run() {
        toggleGameMenu();
      }
    });
    add(gameMenuButton);

    // Load button
    y += vPadding;
    label = FontHelper.firstToUpper(I18n.get("global.load"));
    Button loadButton = new TextButton(label, x, y);
    loadButton.setSize(buttonWidth, buttonHeight);
    loadButton.disable();
    loadButton.hide();
    loadButton.setActionHandler(new ActionHandler() {

      @Override
      public void run() {
        // TODO
      }
    });
    gameMenuButtons.add(loadButton);
    add(loadButton);

    // Save button
    y += vPadding;
    label = FontHelper.firstToUpper(I18n.get("global.save"));
    Button saveButton = new TextButton(label, x, y);
    saveButton.hide();
    saveButton.setSize(buttonWidth, buttonHeight);
    saveButton.disable();
    saveButton.setActionHandler(new ActionHandler() {

      @Override
      public void run() {
        // TODO
      }
    });
    gameMenuButtons.add(saveButton);
    add(saveButton);

    // Settings button
    y += vPadding;
    label = FontHelper.firstToUpper(I18n.get("global.settings"));
    Button settingsButton = new TextButton(label, x, y);
    settingsButton.setSize(buttonWidth, buttonHeight);
    settingsButton.disable();
    settingsButton.hide();
    settingsButton.setActionHandler(new ActionHandler() {

      @Override
      public void run() {
        // TODO
      }
    });
    gameMenuButtons.add(settingsButton);
    add(settingsButton);

    // Main menu button
    y += vPadding;
    label = FontHelper.firstToUpper(I18n.get("global.main_menu"));
    Button mainMenu = new TextButton(label, x, y);
    mainMenu.setSize(buttonWidth, buttonHeight);
    mainMenu.hide();
    mainMenu.setActionHandler(new ActionHandler() {

      @Override
      public void run() {
        GameData.getGame().enterState(AloneInSpace.MAIN_MENU_STATE);
      }
    });
    gameMenuButtons.add(mainMenu);
    add(mainMenu);
   
    // Exit button
    y += vPadding;
    label = FontHelper.firstToUpper(I18n.get("global.exit"));
    Button exitButton = new TextButton(label, x, y);
    exitButton.setSize(buttonWidth, buttonHeight);
    exitButton.hide();
    exitButton.setActionHandler(new ActionHandler() {

      @Override
      public void run() {
        GameData.getGameContainer().exit();
      }
View Full Code Here

  /** Confirmation result */
  protected Boolean confirmed;

  public Confirm(String message) {
//    this.message = message;
    this.cancelButton = new TextButton("Cancel");
    this.okButton = new TextButton("OK");
    this.confirmed = null;

    int height = 100;

    int x = Settings.WIDTH / 2 - WIDTH / 2;
View Full Code Here

      fields.put(r, ef);
    }

    x = Settings.WIDTH / 2 - 5 - TextButton.DEFAULT_WIDTH;
    y = getOY() + getHeight() - 10 - TextButton.DEFAULT_HEIGHT;
    closeButton = new TextButton(I18n.get("global.close"));
    closeButton.setPosition(x, y);
    closeButton.bindTo(twlRootPane);
    closeButton.setActionHandler(new ActionHandler() {

      @Override
      public void run() {
        hide();
      }
    });

    x = Settings.WIDTH / 2 + 5;
    sendButton = new TextButton(I18n.get("global.send"));
    sendButton.setPosition(x, y);
    sendButton.bindTo(twlRootPane);
    sendButton.setActionHandler(new ActionHandler() {

      @Override
View Full Code Here

      }
    });
    add(transferButton);
   
    this.showNewColonyWindow = false;
    this.createColonyButton = new TextButton(I18n.get("global.ok"));
    this.createColonyButton.setWidth(80);
    this.createColonyButton.setActionHandler(new ActionHandler() {

      @Override
      public void run() {
        final Colony c = new Colony();
        c.setName(PlanetState.this.colonyNameField.getText());
        PlanetState.this.colonyNameField.setText("");
        try {
          c.setMap(new TiledMap("data/testmap.tmx"));
        } catch (SlickException e) {
          // TODO Handle TiledMap loading in a manager
          e.printStackTrace();
        }
        c.setResource(Resource.CRISTAL, BigDecimal.valueOf(1000));
        c.setResource(Resource.ENERGY, BigDecimal.valueOf(1000));
        c.setResource(Resource.FOOD, BigDecimal.valueOf(1000));
        c.setResource(Resource.GAS, BigDecimal.valueOf(1000));
        final int selectedIndex = PlanetState.this.map
            .getSelectedZone();

        final HexagonMapAction a = new HexagonMapAction(2,
            PlanetState.this.map, PlanetState.this.map
                .getSelectedZone());
        a.setExploration(false);
        a.setCallback(new Runnable() {

          @Override
          public void run() {
            GameData.putInPool(c);
            PlanetState.this.map.addColonyAt(c, selectedIndex);

            // Create the new selector
            PlanetState.this.colonies.add(new ColonySelector(c,
                getRootPane()));
          }
        });

        GameData.addHexagonMapAction(a);
        stopZoneSelection();
        PlanetState.this.showNewColonyWindow = false;
      }
    });
    createColonyButton.hide();
    add(createColonyButton);

    this.cancelColonyButton = new TextButton(I18n.get("global.cancel"));
    this.cancelColonyButton.setWidth(80);
    this.cancelColonyButton.setActionHandler(new ActionHandler() {

      @Override
      public void run() {
View Full Code Here

    buttons = new ArrayList<TextButton>();

    final int bwidth = 150;
    final int bheight = TextButton.DEFAULT_HEIGHT;
    newGameButton = new TextButton(I18n.getFirstToUpper("global.new_game"));
    newGameButton.setSize(bwidth, bheight);
    newGameButton.setActionHandler(new ActionHandler() {
      public void run() {
        game.enterState(AloneInSpace.SECTOR_STATE);
      }
    });
    getRootPane().add(newGameButton.getBindable());
    buttons.add(newGameButton);

    optionsButton = new TextButton(I18n.getFirstToUpper("global.settings"));
    optionsButton.setSize(bwidth, bheight);
    optionsButton.disable();
    optionsButton.setActionHandler(new ActionHandler() {
      public void run() {
        // TODO
      }
    });
    getRootPane().add(optionsButton.getBindable());
    buttons.add(optionsButton);

    exitButton = new TextButton(I18n.getFirstToUpper("global.exit"));
    exitButton.setSize(bwidth, bheight);
    exitButton.setActionHandler(new ActionHandler() {
      public void run() {
        container.exit();
      }
View Full Code Here

    final int padding = 5;
    final int width = BUTTON_WIDTH * 2 + 15;
    int x = Settings.WIDTH / 2 - width / 2;
    int y = 10;

    this.backToSectorButton = new TextButton(
        I18n.get("research.back_to_sector"));
    this.backToSectorButton.setSize(BUTTON_WIDTH, bh);
    this.backToSectorButton.setPosition(x, y);
    this.backToSectorButton.setActionHandler(new ActionHandler() {

      @Override
      public void run() {
        GameData.getGame().enterState(AloneInSpace.SECTOR_STATE);
      }
    });
    add(backToSectorButton);

    x = this.backToSectorButton.getOX()
        + this.backToSectorButton.getWidth() + padding;
    this.homeButton = new TextButton(I18n.get("research.back_to_root"));
    this.homeButton.setSize(BUTTON_WIDTH, bh);
    this.homeButton.setPosition(x, y);
    this.homeButton.setActionHandler(new ActionHandler() {

      @Override
      public void run() {
        backToRoot = true;
        GameData.setLastViewedTechnology(null);
      }
    });
    add(homeButton);

    x = 600;
    y = Settings.HEIGHT - padding - ImageButton.IB_DEFAULT_SIZE;
    this.startResearchButton = new TextButton(I18n.get("research.start"));
    startResearchButton.setSize(190, 25);
    startResearchButton.hide();
   
    researchProgress.setMaxValue(BigDecimal.valueOf(100));
    this.startResearchButton.setActionHandler(new ActionHandler() {
View Full Code Here

TOP

Related Classes of com.drakulo.games.ais.ui.component.button.TextButton

Copyright © 2018 www.massapicom. 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.