public void goReserveTrain() throws IOException {
   Parent page = FXMLLoader.load(getClass().getResource("BookingReservTrain.fxml"));
   Scene scene = new Scene(page);
   Stage stage = (Stage) homeBtn.getScene().getWindow();
   stage.setScene(scene);
   stage.show();
 }
 private SplashScreen(GriffonApplication app) {
   stage = new Stage();
   stage.initModality(Modality.APPLICATION_MODAL);
   stage.initStyle(StageStyle.TRANSPARENT);
   stage.setScene(createScene(app));
   stage.sizeToScene();
 }
Example #3
0
  @Override
  public void start(Stage stage) throws Exception {
    this.primaryStage = stage;
    primaryStage.setTitle("Matrix Digital Rain");

    Group root = new Group();
    Scene scene = new Scene(root, 1024, 768);
    scene.addEventHandler(
        KeyEvent.KEY_PRESSED,
        new EventHandler<KeyEvent>() {
          @Override
          public void handle(KeyEvent keyEvent) {
            if (keyEvent.getCode() == KeyCode.F) {
              primaryStage.setFullScreen(!primaryStage.isFullScreen());
            }
            if (keyEvent.isControlDown() && keyEvent.getCode() == KeyCode.Q) {
              primaryStage.close();
            }
          }
        });

    Canvas canvas = new Canvas();
    canvas.widthProperty().bind(primaryStage.widthProperty());
    canvas.heightProperty().bind(primaryStage.heightProperty());

    final GraphicsContext gc = canvas.getGraphicsContext2D();
    gc.setFont(font);

    setupSimulation();

    new AnimationTimer() {
      @Override
      public void handle(long now) {
        update(now);

        gc.clearRect(0, 0, primaryStage.getWidth(), primaryStage.getHeight());
        gc.setFill(Color.rgb(0, 0, 1));
        gc.fillRect(0, 0, primaryStage.getWidth(), primaryStage.getHeight());

        int y = 0;
        int nbGlyphsPerRow = getNbGlyphsPerRow();
        int nbGlyphsPerColumn = getNbGlyphsPerColumn();

        for (int i = 0; i < nbGlyphsPerRow * nbGlyphsPerColumn; ++i) {
          gc.setFill(Color.rgb(0, path[i], 0));
          String text = String.valueOf(data[i]);
          gc.fillText(text, (i % nbGlyphsPerRow) * 12 + 1, y + 13);

          if (i % nbGlyphsPerRow == nbGlyphsPerRow - 1) {
            y += 12;
          }
        }
      }
    }.start();

    root.getChildren().add(canvas);

    primaryStage.setScene(scene);
    primaryStage.show();
  }
Example #4
0
  @Override
  public void start(Stage primaryStage) throws Exception {
    BorderPane root = new BorderPane();
    HBox message = new HBox();

    userText = new TextField();
    userText.setEditable(false);
    userText.setOnAction(
        e -> {
          sendMessage(e.getEventType().toString());
          userText.setText("");
        });

    message.getChildren().add(userText);
    message.setAlignment(Pos.CENTER);
    message.setPadding(new Insets(10));

    chatWindow = new TextArea();
    chatWindow.setPrefSize(300, 150);
    chatWindow.setVisible(true);

    root.setCenter(chatWindow);
    root.setBottom(message);

    startRunning();
    primaryStage.setTitle("Instant Messenger");
    primaryStage.setScene(new Scene(root, 300, 275));
    primaryStage.show();
  }
Example #5
0
 public void show() {
     if (!stage.isShowing()) {
         detectScreen();
         changeLayout(senhaLayout);
         stage.show();
     }
 }
Example #6
0
 @Override
 public void start(Stage primaryStage) throws Exception {
   Parent root = FXMLLoader.load(getClass().getResource("/fxml/telaLogin.fxml"));
   primaryStage.setTitle("Login");
   primaryStage.setScene(new Scene(root, 465, 223));
   primaryStage.show();
 }
 public void goHome() throws IOException {
   Parent page = FXMLLoader.load(getClass().getResource("Portal.fxml"));
   Scene scene = new Scene(page);
   Stage stage = (Stage) homeBtn.getScene().getWindow();
   stage.setScene(scene);
   stage.show();
 }
Example #8
0
 @Override
 public void start(Stage primaryStage) throws Exception {
   Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
   primaryStage.setTitle("ToDo Desktop");
   primaryStage.setScene(new Scene(root, 800, 600));
   primaryStage.show();
 }
Example #9
0
 /**
  * Start up the application interface.
  *
  * @param primaryStage Primary stage of the interface.
  * @throws Exception Failed to load resources or open interface.
  */
 @Override
 public void start(Stage primaryStage) throws Exception {
   Parent root = FXMLLoader.load(getClass().getResource("Main.fxml"));
   primaryStage.setTitle("Timed Shutdown");
   primaryStage.setScene(new Scene(root, 360, 170));
   primaryStage.show();
 }
  private void setupStageLocation(Stage stage) {
    ObservableList<Screen> screens = Screen.getScreens();
    Screen screen =
        screens.size() <= screenNumber ? Screen.getPrimary() : screens.get(screenNumber);

    Rectangle2D bounds = screen.getBounds();
    boolean primary =
        screen.equals(
            Screen.getPrimary()); // WORKAROUND: this doesn't work nice in combination with full
    // screen, so this hack is used to prevent going fullscreen when
    // screen is not primary

    if (primary) {
      stage.setX(bounds.getMinX());
      stage.setY(bounds.getMinY());
      stage.setWidth(bounds.getWidth());
      stage.setHeight(bounds.getHeight());
      stage.setFullScreen(true);
    } else {
      stage.setX(bounds.getMinX());
      stage.setY(bounds.getMinY());
      stage.setWidth(bounds.getWidth());
      stage.setHeight(bounds.getHeight());
      stage.toFront();
    }
  }
  @FXML
  private void onOkButtonClicked() {

    if (!headerTextField.getText().isEmpty() || picturePreview.getImage() != null) {
      HTMLHeader header;
      if (!headerTextField.getText().isEmpty() && picturePreview.getImage() == null) {
        header = new HTMLHeader(headerTextField.getText());
        System.out.println("Header only has text.");
      } else if (headerTextField.getText().isEmpty() && picturePreview.getImage() != null) {
        header = new HTMLHeader(picturePreview.getImage());
        System.out.println("Header only has image.");
      } else {
        header = new HTMLHeader(headerTextField.getText(), picturePreview.getImage());
        System.out.println("Header has both image and text.");
      }

      ApplicationManager.getInstance().setWebPageHeader(header);
      System.out.println("Attempting to set header to webpage.");
      // --------------------Added By James------------------------------------------------
      // JavaToHTML HTML = new JavaToHTML();
      // ApplicationManager.getInstance().getHtmlGenerator().setHeaderFromGUI(headerTextField.getText(),picturePath.getText());
      // writeAndRefresh();
      // --------------------End Added By James------------------------------------------------
    } else {
      System.out.println("Header has nothing. Not creating an object.");
    }
    Stage stage = (Stage) okButton.getScene().getWindow();

    stage.close();
  }
  @Override
  public void start(Stage primaryStage) throws Exception {
    Label fnameLbl = new Label(Msg.get(this, "firstName"));
    TextField fnameFld = new TextField();
    Label lnameLbl = new Label(Msg.get(this, "lastName"));
    TextField lnameFld = new TextField();
    Button okBtn = new Button(Msg.get(this, "OK"));
    Button cancelBtn = new Button(Msg.get(this, "cancel"));

    // The OK button should fill its cell
    okBtn.setMaxWidth(Double.MAX_VALUE);

    // Create a GridPane and set its background color to lightgray
    GridPane root = new GridPane();
    root.setGridLinesVisible(true);
    root.setHgap(10);
    root.setVgap(5);
    root.setStyle(Msg.get(this, "style"));

    // Add children to teh GridPane
    root.addRow(0, fnameLbl, fnameFld, okBtn);
    root.addRow(1, lnameLbl, lnameFld, cancelBtn);

    Scene scene = new Scene(root);
    primaryStage.setScene(scene);
    primaryStage.setTitle(Msg.get(this, "title"));
    primaryStage.show();
  }
  @Override
  public void start(Stage stage) throws Exception {

    stage.setTitle("Script Creator");

    // Center
    events = new VBox();
    eventsScrollPane = new ScrollPane();
    eventsScrollPane.setVbarPolicy(ScrollBarPolicy.ALWAYS);
    eventsScrollPane.setContent(events);

    // Left
    VBox left = new VBox();
    Button record = new Button("Record"), add = new Button("Add");
    CheckBox recordWheel = new CheckBox("Wheel"),
        recordMouseMovements = new CheckBox("Movement"),
        recordTime = new CheckBox("Time");
    add.setOnAction(e -> events.getChildren().add(new EditableLabel()));
    left.getChildren().addAll(add, record, recordWheel, recordTime, recordMouseMovements);

    // Bottom

    // Container
    BorderPane mainLayout = new BorderPane();
    mainLayout.setCenter(eventsScrollPane);
    mainLayout.setLeft(left);

    main = new Scene(mainLayout, 300, 250);
    stage.setScene(main);

    stage.show();
  }
  @Override
  public void start(Stage primaryStage) {
    String url = handler.getConnectionUrl();

    WebView browser = new WebView();
    WebEngine webEngine = browser.getEngine();
    webEngine.load(url);

    StackPane root = new StackPane();
    root.getChildren().add(browser);

    Scene scene = new Scene(root, 650, 500);

    primaryStage.setTitle("Acces Token Getter");
    primaryStage.setScene(scene);
    primaryStage.show();

    primaryStage.setOnCloseRequest(
        new EventHandler<WindowEvent>() {
          public void handle(WindowEvent we) {
            try {
              String urlWithAT = webEngine.getLocation();
              handler.setInputUrl(urlWithAT);
              handler.parseUrl();
              handler.writeAccesTokenToFile(OUTPUT_FILE_NAME);
              System.out.print("See file: " + OUTPUT_FILE_NAME);
            } catch (Exception e) {
              System.out.print(e.getMessage());
            }
          }
        });
  }
  @Override
  public void start(Stage stage) throws Exception {
    Parent root = createLayout();
    scene =
        SceneBuilder.create()
            .fill(new Color(0.5, 0.5, 0.5, 1.0))
            .root(root)
            .width(600)
            .height(400)
            .build();
    stage.setScene(scene);
    stage.show();

    // Add values to the spinner controls
    String[] months = new DateFormatSymbols().getMonths();
    ObservableList<String> dayList = FXCollections.observableArrayList();
    ObservableList<String> monthList = FXCollections.observableArrayList(months);
    ObservableList<String> yearList = FXCollections.observableArrayList();
    for (int i = 1; i <= 31; i++) {
      dayList.add(Integer.toString(i));
    }
    for (int i = 1970; i <= 2013; i++) {
      yearList.add(Integer.toString(i));
    }
    spinnerControlDay.setItems(dayList);
    spinnerControlMonth.setItems(monthList);
    spinnerControlYear.setItems(yearList);
  }
 @Override
 public void start(Stage stage) {
   stage.setTitle("Rust Map Helper");
   Data.getInstance().openDataFile("data.yml");
   stage.setScene(Root.getInstance().getScene());
   stage.show();
 }
Example #17
0
  @Override
  public void start(Stage primaryStage) {
    this.primaryStage = primaryStage;
    ApplicationContextHolder.getContext();
    startLogAppender();
    Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionLogger());
    primaryStage.setScene(initScene());
    primaryStage
        .getIcons()
        .addAll(ApplicationContextHolder.getContext().getBeansOfType(Image.class).values());
    primaryStage.setTitle(ApplicationContextHolder.getContext().getBean(Pdfsam.class).name());
    primaryStage.setOnCloseRequest(e -> Platform.exit());
    initWindowsStatusController(primaryStage);
    initOverwriteDialogController(primaryStage);
    initActiveModule();
    primaryStage.show();

    requestCheckForUpdateIfNecessary();
    requestLatestNewsPanelDisplay();
    eventStudio().addAnnotatedListeners(this);
    closeSplash();
    STOPWATCH.stop();
    LOG.info(
        DefaultI18nContext.getInstance()
            .i18n(
                "Started in {0}",
                DurationFormatUtils.formatDurationWords(STOPWATCH.getTime(), true, true)));
  }
  @Test
  public void keyTriggerSetsCoordinatesToFocusOwner() {
    Rectangle rect = new Rectangle(100, 100);
    rect.setTranslateX(100);
    rect.setTranslateY(100);
    Group root = new Group(rect);
    Scene scene = new Scene(root);
    Stage stage = new Stage();
    stage.setScene(scene);
    stage.show();
    rect.requestFocus();

    rect.setOnContextMenuRequested(
        event -> {
          Assert.assertEquals(25.0, event.getX(), 0.0001);
          Assert.assertEquals(125, event.getSceneX(), 0.0001);
          Assert.assertEquals(225, event.getScreenX(), 0.0001);
          Assert.assertEquals(50.0, event.getY(), 0.0001);
          Assert.assertEquals(150, event.getSceneY(), 0.0001);
          Assert.assertEquals(250, event.getScreenY(), 0.0001);
          assertTrue(event.isKeyboardTrigger());
        });

    ((StubScene) scene.impl_getPeer()).getListener().menuEvent(101, 102, 201, 202, true);
  }
  @Override
  public void start(Stage primaryStage) {
    primaryStage.setTitle("CoAP Explorer");
    Group root = new Group();
    Scene scene = new Scene(root, 800, 600);

    TextArea hexArea = new TextArea();
    TextArea binArea = new TextArea();

    CoapPacket packet = new CoapPacket();
    packet.setPayload("PAYLOAD");
    packetProp.setValue(packet);

    binArea.textProperty().bindBidirectional(packetProp, new AsciiConverter());

    hexArea.textProperty().bindBidirectional(packetProp, new HexConverter());
    hexArea.setEditable(false);
    hexArea.setFont(javafx.scene.text.Font.font(Font.MONOSPACED));

    VBox vbox = new VBox();
    vbox.setPadding(new Insets(10));
    vbox.setSpacing(8);

    VBox.setMargin(hexArea, new Insets(0, 0, 0, 8));
    vbox.getChildren().add(hexArea);
    VBox.setMargin(binArea, new Insets(0, 0, 0, 8));
    vbox.getChildren().add(binArea);

    root.getChildren().add(vbox);

    primaryStage.setScene(scene);
    primaryStage.show();
  }
  @Test
  public void testConceptNewJump() {
    // given
    Set<Node> newButtons = conceptMapView.lookupAll(".newBtnTop");
    Node firstNewButton = newButtons.iterator().next();

    moveTo(firstNewButton).press(MouseButton.PRIMARY).release(MouseButton.PRIMARY);
    Node concept = conceptMapView.lookup(".concept");

    double expectedX = concept.getLayoutX() + concept.getTranslateX();
    double expectedY = concept.getLayoutY() + concept.getTranslateY();

    // when

    super.interact(
        () -> {
          stage.setFullScreen(false);
          stage.setWidth(stage.getWidth() - 40);
          stage.setHeight(stage.getHeight() - 40);
        });

    // then

    double actualX = concept.getLayoutX() + concept.getTranslateX();
    double actualY = concept.getLayoutY() + concept.getTranslateY();

    assertEquals(expectedX, actualX, 50);
    assertEquals(expectedY, actualY, 50);
  }
  /**
   * This method is called when the splash screen has finished initializing the application. The
   * initialized resources are in a ServiceLocator singleton. Our task is to now create the
   * application MVC components, to hide the splash screen, and to display the application GUI.
   *
   * <p>Multitasking note: This method is called from an event-handler in the Splash_Controller,
   * which means that it is on the JavaFX Application Thread, which means that it is allowed to work
   * with GUI components. http://docs.oracle.com/javafx/2/threads/jfxpub-threads.htm
   */
  public void startApp() {
    // Stage appStage = new Stage();
    serverStage = new Stage();
    // Resources are now initialized
    ServiceLocator sl = ServiceLocator.getServiceLocator();
    Translator t = sl.getTranslator();
    System.out.println("BLABLA");
    try {
      final URL fxmlURL =
          getClass().getResource("/Server/Server.fxml"); // FXML-File from the ClientLogin-Window
      final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL);
      fxmlLoader.setController(new Server_Controller());
      final Parent root = fxmlLoader.load();
      Scene scene = new Scene(root, 650, 450);
      //			scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
      serverStage.setScene(scene);
      serverStage.setTitle(t.getString("program.name.windowName"));
      serverStage.show();
      String zwischenstatus = fxmlURL.toString();
      System.out.println("Application FXML Loader Pfad ist: " + zwischenstatus);
    } catch (Exception e) {
      e.printStackTrace();
    }

    // Close the splash screen, and set the reference to null, so that all
    // Splash_XXX objects can be garbage collected
    splashView.stop();
    splashView = null;

    //        view.start();
  }
  public void showMissions(final Stage stage) {
    root = new Group();
    int x = 100;
    int y = 100;

    try {
      FileInputStream fis = new FileInputStream("Missions.ifo");
      ObjectInputStream ois = new ObjectInputStream(fis);
      ArrayList<Mission> missions = (ArrayList<Mission>) ois.readObject();
      for (Mission i : missions) {
        if (!curClan.completed.contains(i)) {

          final Mission a = i;
          Button but = new Button(i.misName);
          but.setLayoutX(x);
          but.setLayoutY(y);
          y += 50;
          but.setOnAction(
              new EventHandler() {
                public void handle(Event e) {
                  m = a;
                  startMission(a, stage);
                }
              });
          root.getChildren().add(but);
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    scene = new Scene(root, 720, 600);
    stage.setScene(scene);
    stage.show();
  }
Example #23
0
 @Override
 public void start(Stage primaryStage) throws Exception {
   Parent root = FXMLLoader.load(getClass().getResource("/sample/view/filter.fxml"));
   primaryStage.setTitle("filter");
   primaryStage.setScene(new Scene(root));
   primaryStage.show();
 }
  @Override
  public void start(final Stage primaryStage) throws Exception {
    final int w = 200;
    final int l = 5;
    final int size = w / l;
    final GridPane g = new GridPane();
    g.setPrefSize(w, w);

    final TooltipBehavior behavior = new TooltipBehavior();
    // マウスが乗ってから0.1秒後に表示
    behavior.setOpenDuration(new Duration(100));
    // ずっと表示
    behavior.setHideDuration(Duration.INDEFINITE);
    // マウスが放れてから0.3秒後に非表示
    behavior.setLeftDuration(new Duration(300));

    for (int y = 0; y < l; y++) {
      for (int x = 0; x < l; x++) {
        final Rectangle r = createNode(size);
        g.add(r, x, y);

        // 色をツールチップで表示する
        final Tooltip tooltip = new Tooltip(r.getFill().toString());
        // インストール
        behavior.install(r, tooltip);

        // 普通の動作との違いが見てみたい人は↑をコメントにして
        // ↓をコメント解除してみてください
        // Tooltip.install(r,tooltip);
      }
    }

    primaryStage.setScene(new Scene(g));
    primaryStage.show();
  }
Example #25
0
    @Override
    public void start(final Stage stage) throws Exception {
        this.stage = stage;
        stage.initStyle(StageStyle.UNDECORATED);
        stage.setTitle("PainelFX");
        stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
            @Override
            public void handle(WindowEvent t) {
                self.hide();
            }
        });
        
        // loop infinito
        TimelineBuilder.create().keyFrames(new KeyFrame(Duration.millis(100), new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent t) {
                long time = Calendar.getInstance().getTimeInMillis();
                // processando fila de senha
                processQueue();
                // verificando screensaver
                if (currentLayout != null && !currentLayout.equals(screenSaverLayout)) {
                    Integer screenSaverTimeout = main.getConfig().get(PainelConfig.KEY_SCREENSAVER_TIMEOUT, Integer.class).getValue();
                    if (screenSaverTimeout > 0) {
                        if (time - lastUpdate > screenSaverTimeout * 1000) {
                            self.changeLayout(screenSaverLayout);
                        }
                    }
                }
            }
        })).cycleCount(-1).build().play();

        detectScreen();
        senhaLayout = new SimpleSenhaLayout(this);
        screenSaverLayout = new VideoLayout(this);
    }
Example #26
0
 public MainWindow() {
   this(DEFAULT_WIDTH, DEFAULT_HEIGHT);
   buildGUI();
   sc = new Scene(g, 700, 700);
   s.setScene(sc);
   s.show();
 }
  public void initialize() throws IOException {

    lblMessage.setText("");
    lblMessage.setText("Send Oil Change Reminder Message?");

    btnCancelMessage.setOnAction(
        e -> {
          // System.exit(0);
          Stage stageBox = (Stage) btnCancelMessage.getScene().getWindow();
          stageBox.close();
        });
    btnSendMessage.setOnAction(
        e -> {
          lblMessage.setText("");
          lblMessage.setText("Message Sent!");

          try {
            btnCancelMessage.setAlignment(Pos.CENTER);
            btnSendMessage.setVisible(false);
            btnCancelMessage.setText("Done!");
            Parent stageBox = btnCancelMessage.getParent();
            ((BorderPane) stageBox).setCenter(btnCancelMessage);
          } catch (Exception exception) {
          }
        });
  }
  public FXDialog() {
    // Setup general stage and main grid
    msgLabel = detLabel = null;
    stage = new Stage();
    stage.initModality(Modality.WINDOW_MODAL);
    grid = new GridPane();
    grid.setAlignment(Pos.CENTER);
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(10, 10, 10, 10));

    // Add the OK button (it's a default)
    buttonArea = new HBox(10);
    Button okBtn = new Button("OK");
    okBtn.setOnAction(
        event -> {
          okPressed = true;
          stage.hide();
        });
    buttonArea.getChildren().add(okBtn);
    grid.add(buttonArea, 1, 2);

    // ImageView imageView = new ImageView();
    // grid.add(imageView, 0, 0);

    // Add a 50 width pane for spacing and also as we plan on adding an image at 0,0
    // some time in the future
    Pane pane = new Pane();
    pane.setMinWidth(50);
    grid.add(pane, 0, 1);

    stage.setScene(new Scene(grid, 250, 100));
    okPressed = false;
  }
Example #29
0
 @Override
 public void start(Stage primaryStage) throws Exception {
   Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
   primaryStage.setTitle(getUserNameFull() + "!!!");
   primaryStage.setScene(new Scene(root, 300, 275));
   primaryStage.show();
 }
 public void reserveEditNotConfirm() throws IOException {
   Parent page = FXMLLoader.load(getClass().getResource("BookingEdit.fxml"));
   Scene scene = new Scene(page);
   Stage stage = (Stage) notConfirmReserve.getScene().getWindow();
   stage.setScene(scene);
   stage.show();
 }