Package org.cybuch.jbot.controler

Source Code of org.cybuch.jbot.controler.MainController

package org.cybuch.jbot.controler;

import java.io.IOException;

import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.scene.control.RadioMenuItem;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

import org.cybuch.jbot.gui.JBot;
import org.cybuch.jbot.utils.Global;

public class MainController {

  @FXML
  private MenuBar menuBar;
  @FXML
  private Menu menu;
  @FXML
  private Menu tools;
  @FXML
  private Menu help;
  @FXML
  private MenuItem close;
  @FXML
  private MenuItem runemaker;
  @FXML
  private MenuItem about;
  @FXML
  private Button select;
  @FXML
  private JBot mainApp;
  @FXML
  private AnchorPane selectPane;
  @FXML
  private AnchorPane pane;
  @FXML
  private RadioMenuItem pause;

  public MainController() {
  }

  @FXML
  private void initialize() {
  }

  public void runemaker() throws IOException {
    FXMLLoader loader = new FXMLLoader(
        JBot.class.getResource("Runemaker.fxml"));
    pane = (AnchorPane) loader.load();
    final Stage stage = new Stage();
    stage.initStyle(StageStyle.DECORATED);
    Scene scene = new Scene(pane);
    stage.setScene(scene);
    stage.show();
  }
 
  public void foodEater() throws IOException {
    FXMLLoader loader = new FXMLLoader(
        JBot.class.getResource("Eater.fxml"));
    AnchorPane pane = (AnchorPane) loader.load();
    final Stage stage = new Stage();
    stage.initStyle(StageStyle.DECORATED);
    Scene scene = new Scene(pane);
    stage.setScene(scene);
    stage.show();
  }

  public void close() {
    System.exit(0);
  }

  public void setMainApp(JBot mainApp) {
    this.mainApp = mainApp;
  }
 
  public void help() throws IOException {
    FXMLLoader loader = new FXMLLoader(
        JBot.class.getResource("Help.fxml"));
    AnchorPane helpDialog = (AnchorPane) loader.load();
    Stage stage = new Stage();
    stage.initStyle(StageStyle.UTILITY);
    Scene scene = new Scene(helpDialog);
    stage.setScene(scene);
    stage.show();
  }
 
  public void pickuper() throws IOException {
    FXMLLoader loader = new FXMLLoader(
        JBot.class.getResource("Pickuper.fxml"));
    AnchorPane aPane = (AnchorPane) loader.load();
    Stage stage = new Stage();
    stage.initStyle(StageStyle.DECORATED);
    Scene scene = new Scene(aPane);
    stage.setScene(scene);
    stage.show();
  }
 
  public void fisher() throws IOException {
    FXMLLoader loader = new FXMLLoader(
        JBot.class.getResource("Fisher.fxml"));
    AnchorPane aPane = (AnchorPane) loader.load();
    Stage stage = new Stage();
    stage.initStyle(StageStyle.DECORATED);
    Scene scene = new Scene(aPane);
    stage.setScene(scene);
    stage.show();
  }
 
  @FXML
  public void pause() {
    if (!pause.isSelected()) {
      pause.setSelected(false);
      Global.LOCKED = false;
      return;
    }
    Global.LOCKED = true;
    pause.setSelected(true);
  }
 
}
TOP

Related Classes of org.cybuch.jbot.controler.MainController

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.