/*
  /Check of de naam in de database gelijk is aan de textveld tfBeginUsername
  */
  @FXML
  public void Login() throws IOException, SQLException, NotBoundException {
    try {
      // check if the user is already online.
      for (User usr : loginIn.getOnlineUsers()) {
        if (usr.getName().equals(tfBeginUsername.getText())) {
          Alert alert = new Alert(AlertType.INFORMATION);
          alert.setTitle("Information");
          alert.setHeaderText(null);
          alert.setContentText("User is already online");
          alert.showAndWait();

        } else if (loginIn.Login(tfBeginUsername.getText(), tfBeginPassword.getText()) != null) {
          user = loginIn.Login(tfBeginUsername.getText(), tfBeginPassword.getText());
          LobbySession.user = user;
          userName = user.getName();
          LbLobbyUserName.textProperty().bind(userNameProperty);
          loginIn.addToOnline(LobbySession.user);
          stage = (Stage) btBeginLogIn.getScene().getWindow();
          root = FXMLLoader.load(getClass().getResource("Lobby.fxml"));
          Scene scene = new Scene(root);
          scene.getStylesheets().add((new File("css/Lobby.css")).toURI().toURL().toExternalForm());
          stage.setScene(scene);
          stage.setResizable(false);
          stage.show();

        } else {
          Alert alert = new Alert(AlertType.INFORMATION);
          alert.setTitle("Information");
          alert.setHeaderText(null);
          alert.setContentText("Please enter correct name and password");
          alert.showAndWait();
        }
      }
      if (loginIn.getOnlineUsers().isEmpty()) {
        user = loginIn.Login(tfBeginUsername.getText(), tfBeginPassword.getText());
        LobbySession.user = user;
        userName = user.getName();
        LbLobbyUserName.textProperty().bind(userNameProperty);
        loginIn.addToOnline(LobbySession.user);
        stage = (Stage) btBeginLogIn.getScene().getWindow();
        root = FXMLLoader.load(getClass().getResource("Lobby.fxml"));
        Scene scene = new Scene(root);
        scene.getStylesheets().add((new File("css/Lobby.css")).toURI().toURL().toExternalForm());
        stage.setScene(scene);
        stage.setResizable(false);
        stage.show();
      }
    } catch (Exception ex) {
      System.out.println("Not working: " + ex);
    }
  }
 @Test
 public void test7() throws Throwable {
   final CountDownLatch l = new CountDownLatch(1);
   Platform.runLater(
       () -> {
         final Stage t = new Stage();
         final Scene s = new Scene(new Group());
         t.setScene(s);
         t.show();
         final Stage p = new Stage();
         p.show();
         Platform.runLater(
             () -> {
               try {
                 p.setScene(s);
                 p.hide();
                 t.hide();
               } finally {
                 l.countDown();
               }
             });
       });
   l.await();
   if (exception != null) {
     throw exception;
   }
 }
 private boolean validateText(String text) {
   try {
     int i = Integer.parseInt(text);
     if (i > 50 || i < 0) {
       Stage dialogStage = new Stage();
       dialogStage.initModality(Modality.WINDOW_MODAL);
       dialogStage.setScene(
           new Scene(
               VBoxBuilder.create()
                   .children(new Text("Wartoœæ kroku musi byæ wiêksza od 0 oraz mniejsza od 50."))
                   .alignment(Pos.CENTER)
                   .padding(new Insets(25))
                   .build()));
       dialogStage.show();
       return false;
     }
   } catch (NumberFormatException nfe) {
     Stage dialogStage = new Stage();
     dialogStage.initModality(Modality.WINDOW_MODAL);
     dialogStage.setScene(
         new Scene(
             VBoxBuilder.create()
                 .children(new Text("Wpisana wartosc musi byc liczba calkowita"))
                 .alignment(Pos.CENTER)
                 .padding(new Insets(25))
                 .build()));
     dialogStage.show();
     return false;
   }
   return true;
 }
  @Override
  public void start(Stage primaryStage) {
    Pane p = new Pane();
    for (int i = 0; i < 5; i++) {
      Button b = new Button("pm" + i);
      b.setLayoutX(i * 40);
      b.setLayoutY(i * 20);
      p.getChildren().add(b);
    }
    Scene s = new Scene(p);
    primaryStage.setScene(s);
    primaryStage.setTitle("Gauche à droite");
    primaryStage.setX(0);
    primaryStage.setY(0);
    primaryStage.show();

    Stage st = new Stage();
    Pane pt = new Pane();
    for (int i = 0; i < 5; i++) {
      Button b = new Button("s" + i);
      b.setLayoutX((4 - i) * 40);
      b.setLayoutY(i * 20);
      pt.getChildren().add(b);
    }
    Scene t = new Scene(pt);
    st.setScene(t);
    st.setTitle("Droite à gauche");
    st.setX(400);
    st.setY(400);

    st.show();
  }
  @Override
  public void start(Stage primaryStage) throws MalformedURLException {

    initialize();

    primaryStage.setTitle("Media Player");
    Group root = new Group();
    Scene scene = new Scene(root, 540, 241);

    // create media player
    File file = new File(MEDIA_URL);
    Media media = null;
    try {
      if (file.exists()) {

        System.out.println("FILE EXISTS");
        media = new Media(file.toURI().toURL().toExternalForm());
        MediaPlayer mediaPlayer = new MediaPlayer(media);
        mediaPlayer.setAutoPlay(false);
        MediaControl mediaControl = new MediaControl(mediaPlayer);
        scene.setRoot(mediaControl);

        primaryStage.setScene(scene);
        primaryStage.show();
      } else {
        Dialogs.showErrorDialog(
            null, null, "Instrumental file not found. Please contact the administrator.", "ERROR");
      }
    } catch (Exception e) {
      System.out.println("FILE DOES NOT EXIST");
      // FileChooser fileChooser = new FileChooser();

      // Set extension filter
      // FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("MP3 files
      // (*.mp3)", "*.mp3");
      // fileChooser.getExtensionFilters().add(extFilter);

      // Show open file dialog
      // file = fileChooser.showOpenDialog(null);
      // String url =
      // "http://mp3crow.mobi/dl/aHR0cDovL2FwaS5zb3VuZGNsb3VkLmNvbS90cmFja3MvNjg4ODI2OTUvc3RyZWFtP2NsaWVudF9pZD1mZmEwYzc5YmY4YWVkYzBkOWIwYmIwNzQyNzhjZjI1MQ==yFRzUi1GcmVzaCAmIFNjcmF0Y2gtRCBvZiBEeW5hbWl4IElJIC0gUm9ja2luIHRvIHRoZSBCZWF0IHRoYXQgaXMgc28gRnJlc2hoaGhoaGho.mp3";
      // media = new Media(file.toURI().toURL().toExternalForm());
      // MediaPlayer mediaPlayer = new MediaPlayer(media);
      // mediaPlayer.setAutoPlay(false);
      // MediaControl mediaControl = new MediaControl(mediaPlayer);
      // scene.setRoot(mediaControl);

      String content = open();

      root.getChildren().add(new Button(content));

      primaryStage.setScene(scene);
      primaryStage.show();
      // Dialogs.showErrorDialog(null, null, "Instrumental file not found. Please contact the
      // administrator.", "ERROR");
    }
  }
示例#6
0
  @Override
  public void start(final Stage primaryStage) {
    primaryStage.setTitle("Dialog");
    Group root = new Group();
    Scene scene = new Scene(root, 400, 300, Color.WHITE);

    primaryStage.setScene(scene);
    primaryStage.show();

    Stage myDialog = new MyDialog(primaryStage);
    myDialog.sizeToScene();
    myDialog.show();
  }
  public void login(String name, String paswd) throws LoginException, IOException {
    System.out.println(name);
    System.out.println(paswd);
    DataAccess da = new DataAccessFacade();
    HashMap<String, User> map = da.readUserMap();
    if (!map.containsKey(name)) {
      errorMessage.setText("*Name not found!");
      throw new LoginException("Name " + name + " not found");
    }
    String passwordFound = map.get(name).getPassword();
    if (!passwordFound.equals(paswd)) {
      errorMessage.setText("*Password not match!");
      throw new LoginException("Passord does not match password on record");
    }
    currentAuth = map.get(name).getAuthorization();
    System.out.println("Successfully login by " + currentAuth.toString());
    if (currentAuth.toString().equals("LIBRARIAN")) {
      Stage libStage = new Stage();
      Parent root;
      try {
        root = FXMLLoader.load(getClass().getResource("../view/LiberianMain.fxml"));
        libStage.setTitle("Librarian - Checkin/Checkout");
        Scene scene = new Scene(root, 1000, 800);
        libStage.setScene(scene);
        libStage.show();
        userName.getScene().getWindow().hide();

      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
    if (currentAuth.toString().equals("ADMIN")) {
      Stage libStage = new Stage();
      Parent root;
      try {
        root = FXMLLoader.load(getClass().getResource("../view/AdministratorMain.fxml"));
        libStage.setTitle("Administrator");
        Scene scene = new Scene(root, 1000, 800);
        libStage.setScene(scene);
        libStage.show();
        userName.getScene().getWindow().hide();

      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
  }
  @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();
  }
  private void createNewStage(int level, Stage owner, boolean onTop) {
    Stage stage = new Stage();
    stage.initOwner(owner);
    stage.setTitle(level == 0 ? "Root" : "Child " + level);
    stage.setAlwaysOnTop(onTop);

    VBox root = new VBox(15);
    root.setPadding(new Insets(20));
    Scene scene = new Scene(root);
    stage.setScene(scene);

    ToggleButton onTopButton = new ToggleButton(onTop ? DISABLE_ON_TOP : ENABLE_ON_TOP);
    onTopButton.setSelected(onTop);

    stage
        .alwaysOnTopProperty()
        .addListener(
            (observable, oldValue, newValue) -> {
              onTopButton.setSelected(newValue);
              onTopButton.setText(newValue ? DISABLE_ON_TOP : ENABLE_ON_TOP);
            });

    onTopButton.setOnAction(event -> stage.setAlwaysOnTop(!stage.isAlwaysOnTop()));

    CheckBox box = new CheckBox("Child stage always on top");
    box.setSelected(true);
    Button newStageButton = new Button("Open child stage");

    newStageButton.setOnAction(event -> createNewStage(level + 1, stage, box.isSelected()));

    root.getChildren().addAll(onTopButton, box, newStageButton);

    stage.show();
  }
示例#10
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();
 }
示例#11
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)));
  }
  @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);
  }
示例#13
0
 public MainWindow() {
   this(DEFAULT_WIDTH, DEFAULT_HEIGHT);
   buildGUI();
   sc = new Scene(g, 700, 700);
   s.setScene(sc);
   s.show();
 }
示例#14
0
  @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();
  }
示例#15
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();
  }
示例#16
0
文件: Main.java 项目: Kilnar/Avito
 @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();
 }
  /**
   * 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();
  }
示例#18
0
  private void showBoardPicker(List<String> boards) {
    BoardPickerDialog boardPickerDialog = new BoardPickerDialog(boards, stage);
    Optional<String> result = boardPickerDialog.showAndWait();
    stage.show();

    result.ifPresent(res -> ui.getMenuControl().switchBoard(res));
  }
示例#19
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();
 }
示例#20
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();
 }
示例#21
0
  @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();
  }
 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();
 }
 @Override
 public void start(Stage stage) {
   stage.setTitle("Rust Map Helper");
   Data.getInstance().openDataFile("data.yml");
   stage.setScene(Root.getInstance().getScene());
   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());
            }
          }
        });
  }
示例#25
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();
  }
  @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);
  }
示例#27
0
 public void show() {
     if (!stage.isShowing()) {
         detectScreen();
         changeLayout(senhaLayout);
         stage.show();
     }
 }
  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();
  }
示例#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();
 }
示例#30
0
  @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();
  }