예제 #1
0
파일: Main.java 프로젝트: garzoc/group17
  @Override
  public void start(Stage primaryStage) {
    try {
      TabPane page = (TabPane) FXMLLoader.load(Main.class.getResource("simple.fxml"));
      Scene scene = new Scene(page);
      primaryStage.setScene(scene);
      primaryStage.setTitle("Hotels");
      primaryStage.show();

      textf = (TextField) scene.lookup("#HotelNameTextb");
      Button create = (Button) scene.lookup("#CreateButton");
      create.setOnAction(this::handleButtonAction);

    } catch (Exception ex) {
      Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
예제 #2
0
파일: MainFX.java 프로젝트: hius74/projects
/** @author Sergey Stishenko <*****@*****.**> */
public class MainFX extends Application {

  private static final Logger LOG = Logger.getLogger(MainFX.class.getName());

  @Override
  public void start(Stage stage) {
    stage.setScene(new MainScene(stage));
    stage.setTitle("Мой бюджет");
    stage.show();
  }

  public static void showMessage(String message) {
    LOG.log(Level.SEVERE, "Сообщение: {0}", message);

    Alert alert = new Alert(Alert.AlertType.INFORMATION, message, ButtonType.OK);
    alert.showAndWait();
  }

  public static void showError(String message, Throwable t) {
    LOG.log(Level.SEVERE, "Сообщение: " + message, t);

    StringBuilder s = new StringBuilder(message).append('\n');
    s.append(t.getClass().getName()).append(": ").append(t.getLocalizedMessage());
    for (StackTraceElement e : t.getStackTrace()) {
      String line = e.toString();
      if (line.startsWith("my")) {
        s.append("\n    ").append(line);
      }
    }
    Alert alert = new Alert(Alert.AlertType.ERROR, s.toString(), ButtonType.OK);
    alert.showAndWait();
  }

  public static void main(String[] args) {
    Application.launch(MainFX.class, args);
  }
}