Java 类javafx.event.EventHandler 实例源码

项目:CryptoPayAPI    文件:CryptoTest.java   
private Resource(Scene start, String name, int startCost, long value, long delay, double mult, final MoneyListener listener){
    System.out.println(name);
    this.prog = (ProgressBar) start.lookup("#" + name + "_progress");
    this.made = (Label) start.lookup("#" + name + "_money");
    this.buy = (Button) start.lookup("#" + name + "_buy");

    this.multiply = mult;
    this.name = name;
    this.print = (name.charAt(0) + "").toUpperCase() + name.substring(1);
    this.value = value;
    this.cost = startCost;
    this.delay = delay;
    this.listener = listener;

    setText(made, print + " Earnings: " + format.format(money));
    setText(buy, "(" + miners + ") Buy Miner: " + format.format((long)cost));

    this.buy.setOnAction(new EventHandler<ActionEvent>() {
        public void handle(ActionEvent event) {
            listener.buyMiner(Resource.this.name);
        }
    });
}
项目:FYS_T3    文件:searchLugController.java   
@FXML
public void openHelp(ActionEvent event) throws IOException {
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/helpPopup.fxml"));
    final Scene scene = new Scene(root);
    final Stage stage = new Stage();
    stage.setTitle("Help");
    stage.setScene(scene);
    stage.show();
    stage.setResizable(false);
    stage.centerOnScreen();

    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.close();
            }
        }
    });
}
项目:marathonv5    文件:AdvCandleStickChartSample.java   
@Override protected void seriesRemoved(Series<Number, Number> series) {
    // remove all candle nodes
    for (XYChart.Data<Number, Number> d : series.getData()) {
        final Node candle = d.getNode();
        if (shouldAnimate()) {
            // fade out old candle
            FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
            ft.setToValue(0);
            ft.setOnFinished(new EventHandler<ActionEvent>() {

                @Override
                public void handle(ActionEvent actionEvent) {
                    getPlotChildren().remove(candle);
                }
            });
            ft.play();
        } else {
            getPlotChildren().remove(candle);
        }
    }
}
项目:GazePlay    文件:StatsDisplay.java   
private static EventHandler<Event> createZoomOutLineChartEventHandler(LineChart<String, Number> lineChart,
        Scene scene, int originalIndexInParent) {
    return new EventHandler<Event>() {
        @Override
        public void handle(Event e) {
            lineChart.removeEventHandler(MouseEvent.MOUSE_CLICKED, this);

            zoomOutAndReset(lineChart);

            resetToOriginalIndexInParent(lineChart, originalIndexInParent);

            lineChart.addEventHandler(MouseEvent.MOUSE_CLICKED,
                    createZoomInLineChartEventHandler(lineChart, scene));
        }

    };
}
项目:fwm    文件:WorldSelector.java   
@FXML
public void addNewWorld(){
    final File f = new File(AppConfig.getWorldsLocation() + newWorldName.getText());
    f.mkdirs();

    Button cur = new Button(f.getName());
    cur.setOnAction(new EventHandler<ActionEvent>(){
        public void handle(ActionEvent event) {
            selectedFile = new File(AppConfig.getWorldsLocation() + f.getName());
            closeWindow();
        }
    });
    cur.setFont(bFont);
    cur.minWidthProperty().bind(worlds.widthProperty().subtract(10));
    worlds.getChildren().add(cur);
}
项目:FYS_T3    文件:submitController.java   
@FXML
public void openSubmitAction(ActionEvent event) throws IOException {
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    final Scene hScene = new Scene(home);
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/Submit.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();

    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.setScene(hScene);
            }
        }
    });
}
项目:GazePlay    文件:WhereIsIt.java   
private EventHandler<ActionEvent> createProgressIndicatorAnimationTimeLineOnFinished(WhereIsIt gameInstance) {
    return new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent actionEvent) {

            log.debug("FINISHED");

            selected = true;

            imageRectangle.removeEventFilter(MouseEvent.ANY, customInputEventHandler);
            imageRectangle.removeEventFilter(GazeEvent.ANY, customInputEventHandler);
            GazeUtils.removeEventFilter(imageRectangle);

            if (winner) {
                onCorrectCardSelected(gameInstance);
            } else {
                // bad card
                onWrongCardSelected(gameInstance);
            }
        }
    };
}
项目:dialog-tool    文件:RaiseEventTransitionController.java   
@Override
public void init(Stage stage, Scene scene, Pane pane) {
    addButton.setOnMouseClicked(new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent event) {
            //add transition

            String eventName = eventNameTextField.getText();

            if (eventName.isEmpty()) {
                return;
            }

            RaiseEventTransition transition = new RaiseEventTransition(eventName);
            entry.getTranstionList(index).add(transition);

            //refresh listview
            paneController.refreshListView();

            stage.close();
        }
    });
}
项目:Dronology    文件:ButtonGenerator.java   
/**
 * Initial return to home base command
 * @param flightZoneView
 * @param btnText
 * @param stage
 * @return
 */
Button makeReturnHomeButton(final FlightZoneView flightZoneView, String btnText, Stage stage){
    Button platoonBtn = createButton(btnText, 120);
    platoonBtn.setOnAction(
    new EventHandler<ActionEvent>() {
       @Override
       public void handle(final ActionEvent e) {
            try {
                flightZoneView.flightManager.getFlights().groundAllFlights();
            } catch (FlightZoneException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
         }
    });
    return platoonBtn;
}
项目:dragdropfx    文件:TextDragListenerContext.java   
private EventHandler<MouseEvent> makeOnButtonDownListener(){
    return new EventHandler<MouseEvent>() {

        @Override
        public void handle(MouseEvent event) {
            if(event.getButton() == MouseButton.PRIMARY){
                HitInfo i = DnDTextInput.getHitInfo((TextInputControl) event.getSource(), event);
                IndexRange r = textInput.getSelection();

                if(DnDTextInput.isInRange(i.getInsertionIndex(), r)){
                    currentSelection = r;
                }

                inClick = true;
            }
        }
    };
}
项目:incubator-netbeans    文件:ChartAdvancedStockLine.java   
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setScene(new Scene(root));
    root.getChildren().add(createChart());
    // create timeline to add new data every 60th of second
    animation = new Timeline();
    animation.getKeyFrames().add(new KeyFrame(Duration.millis(1000/60), new EventHandler<ActionEvent>() {
        @Override public void handle(ActionEvent actionEvent) {
            // 6 minutes data per frame
            for(int count=0; count < 6; count++) {
                nextTime();
                plotTime();
            }
        }
    }));
    animation.setCycleCount(Animation.INDEFINITE);
}
项目:Dronology    文件:InteractiveFlightPlannerView.java   
private Button createSaveFlightButton(Stage stage){
       Button btnSaveFlight = new Button();
       btnSaveFlight.setLayoutX(10);
       btnSaveFlight.setLayoutY(60);;
       btnSaveFlight.setText("Save Flight");

       btnSaveFlight.setOnAction(       
       new EventHandler<ActionEvent>() {
          @Override
          public void handle(final ActionEvent e) {
           FileChooser fileChooser = new FileChooser();
               fileChooser.setTitle("Flight plan (xml)");
               File file = fileChooser.showSaveDialog(stage);
               if (file != null) {
                   System.out.println("Selected " + file);
                   try {
                        fzv.setPlanningMode(false);
                    new SaveXMLFlight(file.getAbsolutePath(),wayPoints);
               } catch (IOException | FlightZoneException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
               }     
            }
       }});
       return btnSaveFlight;
}
项目:dialog-tool    文件:GiveQuestTransitionController.java   
@Override
public void init(Stage stage, Scene scene, Pane pane) {
    addButton.setOnMouseClicked(new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent event) {
            //add transition

            String questName = questNameTextField.getText();

            if (questName.isEmpty()) {
                return;
            }

            GiveQuestTransition transition = new GiveQuestTransition(questName);
            entry.getTranstionList(index).add(transition);

            //refresh listview
            paneController.refreshListView();

            stage.close();
        }
    });
}
项目:dialog-tool    文件:MainWindow.java   
public MainWindow (LangLoader langLoader) {
    super("Leeks & Dragons - Dialog Tool", 820, 640, "./data/ui/mainwindow.fxml", new MainWindowController(langLoader));

    //add handler which will be executed, if user closes window
    this.stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
        @Override
        public void handle(WindowEvent event) {
            System.exit(0);
        }
    });

    //set window position to center and focus window
    this.stage.centerOnScreen();
    this.stage.requestFocus();

    //set window visible
    this.stage.show();
}
项目:ShowMilhaoPOOJava    文件:ControllerLayoutTelaCreditos.java   
private void makeFadeOut(String path) {
    FadeTransition fadeTransition = new FadeTransition();
    fadeTransition.setDuration(Duration.millis(250));
    fadeTransition.setNode(rootPane);
    fadeTransition.setFromValue(1);
    fadeTransition.setToValue(0);
    fadeTransition.setOnFinished(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            try {
                loadScreenPlay(path);
            } catch (IOException ex) {
                Logger.getLogger(ControllerLayoutInicial.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    });
    fadeTransition.play();
}
项目:marathonv5    文件:AdvCandleStickChartSample.java   
@Override protected void seriesRemoved(Series<Number, Number> series) {
    // remove all candle nodes
    for (XYChart.Data<Number, Number> d : series.getData()) {
        final Node candle = d.getNode();
        if (shouldAnimate()) {
            // fade out old candle
            FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
            ft.setToValue(0);
            ft.setOnFinished(new EventHandler<ActionEvent>() {

                @Override
                public void handle(ActionEvent actionEvent) {
                    getPlotChildren().remove(candle);
                }
            });
            ft.play();
        } else {
            getPlotChildren().remove(candle);
        }
    }
}
项目:ShowMilhaoPOOJava    文件:ControllerLayoutTelaVencedor.java   
private void makeFadeOut(String path) {
    FadeTransition fadeTransition = new FadeTransition();
    fadeTransition.setDuration(Duration.millis(250));
    fadeTransition.setNode(rootPane);
    fadeTransition.setFromValue(1);
    fadeTransition.setToValue(0);
    fadeTransition.setOnFinished(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            try {
                loadScreenPlay(path);
            } catch (IOException ex) {
                Logger.getLogger(ControllerLayoutInicial.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    });
    fadeTransition.play();
}
项目:marathonv5    文件:SearchBoxSample.java   
public SearchBox() {
    setId("SearchBox");
    getStyleClass().add("search-box");
    setMinHeight(24);
    setPrefSize(200, 24);
    setMaxSize(Control.USE_PREF_SIZE, Control.USE_PREF_SIZE);
    textBox = new TextField();
    textBox.setPromptText("Search");
    clearButton = new Button();
    clearButton.setVisible(false);
    getChildren().addAll(textBox, clearButton);
    clearButton.setOnAction(new EventHandler<ActionEvent>() {                
        @Override public void handle(ActionEvent actionEvent) {
            textBox.setText("");
            textBox.requestFocus();
        }
    });
    textBox.textProperty().addListener(new ChangeListener<String>() {
        @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
            clearButton.setVisible(textBox.getText().length() != 0);
        }
    });
}
项目:GazePlay    文件:Target.java   
private EventHandler<Event> buildEvent() {

        return e -> {

            // if((e.getEventType() == MouseEvent.MOUSE_ENTERED_TARGET ||e.getEventType() == MouseEvent.MOUSE_ENTERED ||
            // e.getEventType() == MouseEvent.MOUSE_MOVED || e.getEventType() == GazeEvent.GAZE_ENTERED ||
            // e.getEventType() == GazeEvent.GAZE_MOVED) && anniOff) {

            if (animationStopped
                    && (e.getEventType() == MouseEvent.MOUSE_ENTERED || e.getEventType() == GazeEvent.GAZE_ENTERED)) {

                animationStopped = false;
                enter(e);
            }
        };
    }
项目:gomoku    文件:BoardPaneController.java   
/**
 * Handle the userMoveRequested() event from the game.
 * @param playerIndex Player index to retrieve move for
 */
private void handleUserMoveRequested(int playerIndex) {
    // Enable the picker on the board to aid the user when picking a move
    Platform.runLater(() -> boardView.enableStonePicker(playerIndex));
    // Listener submits a move to the game, which can be declined if
    // invalid, if accepted the listener is removed and the picker is
    // disabled
    this.mouseListener = new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent event) {
            int row = boardView.getClosestRow(event.getY());
            int col = boardView.getClosestCol(event.getX());
            if(game.setUserMove(new Move(row, col))) {
                boardView.removeEventHandler(MouseEvent
                        .MOUSE_CLICKED, this);
                Platform.runLater(() -> boardView.disableStonePicker());
            }
        }
    };
    boardView.addEventHandler(MouseEvent.MOUSE_CLICKED,
            mouseListener);
}
项目:BatpackJava    文件:batteryMonitorLayoutController.java   
private void buildMenuItem() {
    for (int i = 0; i < this.batpack.getModuleCount(); i++) {
        Group module = batteryModules.get(i);
        String labelText = ((Label) module.getChildren().get(3)).getText();
        MenuItem menuItem = new MenuItem(labelText);
        menuItem.setId(Integer.toString(i));
        EventHandler<ActionEvent> updateCells;
        updateCells = (event) -> {
            MenuItem menu = (MenuItem) event.getSource();
            int id = Integer.parseInt(menu.getId());
            moduleChooser.setText("module " + (id + 1));
            updateCells(id);
        };
        menuItem.setOnAction(updateCells);
        List<MenuItem> menuItems = new ArrayList<>();
        menuItems.add(menuItem);
        moduleChooser.getItems().addAll(menuItems);
    }
}
项目:javafx-experiments    文件:HelloWorldApp.java   
@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Hello World!");
    Button btn = new Button();
    btn.setText("Say 'Hello World'");
    btn.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            System.out.println("Hello World!");
        }
    });

    StackPane root = new StackPane();
    root.getChildren().add(btn);
    primaryStage.setScene(new Scene(root, 300, 250));
    primaryStage.show();
}
项目:dragdropfx    文件:DnDPrepare.java   
public static void gfx(final Node n) {
    n.setOnDragDetected(new EventHandler<MouseEvent>() {

        @Override
        public void handle(MouseEvent e) {
            Dragboard db = n.startDragAndDrop(TransferMode.ANY);
            db.setContent(image(n.snapshot(null, null)));
        }

    });
}
项目:marathonv5    文件:StageSample.java   
public StageSample() {
    //create a button for initializing our new stage
    Button button = new Button("Create a Stage");
    button.setStyle("-fx-font-size: 24;");
    button.setDefaultButton(true);
    button.setOnAction(new EventHandler<ActionEvent>() {
        @Override public void handle(ActionEvent t) {
            final Stage stage = new Stage();
            //create root node of scene, i.e. group
            Group rootGroup = new Group();
            //create scene with set width, height and color
            Scene scene = new Scene(rootGroup, 200, 200, Color.WHITESMOKE);
            //set scene to stage
            stage.setScene(scene);
            //center stage on screen
            stage.centerOnScreen();
            //show the stage
            stage.show();
            //add some node to scene
            Text text = new Text(20, 110, "JavaFX");
            text.setFill(Color.DODGERBLUE);
            text.setEffect(new Lighting());
            text.setFont(Font.font(Font.getDefault().getFamily(), 50));
            //add text to the main root group
            rootGroup.getChildren().add(text);
        }
    });
    getChildren().add(button);
}
项目:GameAuthoringEnvironment    文件:BasicUIFactory.java   
/**
 * Creates a button with the given CSS style class
 *
 * @param text
 * @param action
 * @return
 */

@Override
public Button createStyledButton (String text,
                                  EventHandler<ActionEvent> action,
                                  String styleClass) {
    Button newButton = createStyledButton(text, styleClass);
    newButton.setOnAction(action);
    return newButton;
}
项目:fwm    文件:GenericTextController.java   
public void start(Stage primaryStage, Pane rootLayout, String title) throws Exception {
   primaryStage.setTitle(title);
   Scene myScene = new Scene(rootLayout);
   primaryStage.setScene(myScene);
   primaryStage.show();

   primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
       public void handle(WindowEvent we) {
           isOpen = false;
       }
   });
   textArea.setWrapText(true);
   textArea.setEditable(false);
}
项目:fwm    文件:ShowPlayersController.java   
public void start(Stage primaryStage, ScrollPane rootLayout) throws Exception {
    primaryStage.setTitle("Player View - " + App.worldFileUtil.getWorldName());
    Scene myScene = new Scene(rootLayout);
    myScene.getStylesheets().add(App.retGlobalResource("/src/main/ui/showPlayersStylesheet.css").toString());

    primaryStage.getIcons()
.add(new Image(App.retGlobalResource("/src/main/webapp/WEB-INF/images/icons/player/64.png").openStream()));
    primaryStage.setScene(myScene);
    primaryStage.setMinWidth(640);
    primaryStage.setMinHeight(520);

    image.fitWidthProperty().bind(imageViewHBox.widthProperty().subtract(10));
    image.fitHeightProperty().bind(imageViewHBox.heightProperty().subtract(10));

    ourStage = primaryStage;
    ourStage.setOnCloseRequest(new EventHandler(){
    public void handle(javafx.event.Event event) {
        closeWindow();
    }
    });
    HotkeyController.giveGlobalHotkeys(myScene);
    setScene(myScene);
    if(AppConfig.getDarkMode())
{
        setDark(true);
}
    started = true;
  }
项目:GazePlay    文件:ConfigurationButton.java   
public static ConfigurationButton createConfigurationButton(ConfigurationContext configurationContext) {
    ConfigurationButton configurationButton = new ConfigurationButton();
    configurationButton.addEventHandler(MouseEvent.MOUSE_CLICKED, (EventHandler<Event>) e -> {
        configurationContext.getGazePlay().onDisplayConfigurationManagement(configurationContext);
    });
    return configurationButton;
}
项目:LCL    文件:ZoomTransition.java   
private static void zoom(Node node, double scaleFrom, double scaleTo, double opacity, EventHandler<ActionEvent> eventHandler) {
    ScaleTransition scaleTransition = new ScaleTransition(Duration.millis(200), node);
    scaleTransition.setToX(scaleTo);
    scaleTransition.setToY(scaleTo);
    scaleTransition.setFromX(scaleFrom);
    scaleTransition.setFromY(scaleFrom);
    FadeTransition fadeTransition = new FadeTransition(Duration.millis(200), node);
    fadeTransition.setFromValue(opacity);
    fadeTransition.setToValue(1D - opacity);
    ParallelTransition parallelTransition = new ParallelTransition(fadeTransition, scaleTransition);
    parallelTransition.play();
    parallelTransition.setOnFinished(eventHandler);
}
项目:desktop-gmail-client    文件:CustomListCell.java   
public CustomListCell(String labelId) {
    super();
    this.labelId = labelId;
    clcv = new CustomListCellView1(labelId);
    setOnMouseClicked(new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent event) {

        }
    });

}
项目:GameAuthoringEnvironment    文件:BasicUIFactory.java   
@Override
public Button createImageButton (String text,
                                 ImageView imgview,
                                 EventHandler<ActionEvent> action) {
    Button newButton = new Button(text, imgview);
    newButton.setOnAction(action);
    return newButton;
}
项目:gatepass    文件:AllAttendance.java   
@SuppressWarnings({ "rawtypes", "unchecked" })
private void setAnimation(){
    // Initially hiding the Top Pane
    clipRect = new Rectangle();
    clipRect.setWidth(boxBounds.getWidth());
    clipRect.setHeight(0);
    clipRect.translateYProperty().set(boxBounds.getWidth());
    laytable.setClip(clipRect);
    laytable.translateYProperty().set(-boxBounds.getWidth());

    // Animation for bouncing effect.
    final Timeline timelineBounce = new Timeline();
    timelineBounce.setCycleCount(2);
    timelineBounce.setAutoReverse(true);
    final KeyValue kv1 = new KeyValue(clipRect.heightProperty(), (boxBounds.getHeight()-15));
    final KeyValue kv2 = new KeyValue(clipRect.translateYProperty(), 15);
    final KeyValue kv3 = new KeyValue(laytable.translateYProperty(), -15);
    final KeyFrame kf1 = new KeyFrame(Duration.millis(100), kv1, kv2, kv3);
    timelineBounce.getKeyFrames().add(kf1);

    // Event handler to call bouncing effect after the scroll down is finished.
    EventHandler onFinished = new EventHandler() {
        @Override
        public void handle(Event event) {
            timelineBounce.play();
        }
    };

    timelineDown = new Timeline();
    timelineUp = new Timeline();

    // Animation for scroll down.
    timelineDown.setCycleCount(1);
    timelineDown.setAutoReverse(true);
    final KeyValue kvDwn1 = new KeyValue(clipRect.heightProperty(), boxBounds.getWidth());
    final KeyValue kvDwn2 = new KeyValue(clipRect.translateYProperty(), 0);
    final KeyValue kvDwn3 = new KeyValue(laytable.translateYProperty(), 0);
    final KeyFrame kfDwn = new KeyFrame(Duration.millis(1000), onFinished, kvDwn1, kvDwn2, kvDwn3);
    timelineDown.getKeyFrames().add(kfDwn);

    // Animation for scroll up.
    timelineUp.setCycleCount(1); 
    timelineUp.setAutoReverse(true);
    final KeyValue kvUp1 = new KeyValue(clipRect.heightProperty(), 0);
    final KeyValue kvUp2 = new KeyValue(clipRect.translateYProperty(), boxBounds.getHeight());
    final KeyValue kvUp3 = new KeyValue(laytable.translateYProperty(), -boxBounds.getHeight());
    final KeyFrame kfUp = new KeyFrame(Duration.millis(1000), kvUp1, kvUp2, kvUp3);
    timelineUp.getKeyFrames().add(kfUp);

}
项目:Curriculum-design-of-data-structure    文件:HuffmanController.java   
public void bindHboxEvents(){

        hbox.setOnScroll(new EventHandler<ScrollEvent>() {
            @Override
            public void handle(ScrollEvent event) {

                if(hbox.getLayoutX() >= -850)
                    hbox.setLayoutX(hbox.getLayoutX() - 100);
                else{
                    hbox.setLayoutX(50);
                }
                System.out.println(hbox.getLayoutX());
            }
        });
    }
项目:CDN-FX-2.2    文件:CDNFXController.java   
@FXML
protected void btnClickedRebuildRawContent(){
    Alert warning = new Alert(Alert.AlertType.WARNING);
    Stage stage2 = (Stage)warning.getDialogPane().getScene().getWindow();
    stage2.getIcons().add(new Image("/resources/gciaicon.png"));
    warning.setTitle("Warning");
    warning.setHeaderText("Rebuild raw content");
    warning.setContentText("This function will ignore the settings how the CIAs will be build. All produced CIAs will only have a TitleID!");
    warning.showAndWait();

    try {
        FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/gui/RebuildCIA.fxml"));
        Parent root2 = (Parent) fxmlLoader.load();
        Stage stage = new Stage();
        stage.getIcons().add(new Image("/resources/gciaicon.png"));
        stage.initModality(Modality.APPLICATION_MODAL);
        stage.initStyle(StageStyle.DECORATED);
        stage.setTitle("Rebuild raw content");
        stage.setScene(new Scene(root2));
        stage.setResizable(false);
        stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
            @Override
            public void handle(WindowEvent event) {
                // consume event
                event.consume();
            }
        });
        RebuildCIAController rb = fxmlLoader.getController();
        rb.setInput(tmoutputpath);
        stage.show();
    }catch (Exception e){
        StringWriter errors = new StringWriter();
        e.printStackTrace(new PrintWriter(errors));
        DebugLogger.log(errors.toString(), Level.SEVERE);
    }
}
项目:jmonkeybuilder    文件:FXEventManager.java   
/**
 * Add a new event handler.
 *
 * @param eventType    the event type.
 * @param eventHandler the event handler.
 */
@FXThread
public void addEventHandler(@NotNull final EventType<? extends Event> eventType,
                            @NotNull final EventHandler<? super Event> eventHandler) {

    final Array<EventHandler<? super Event>> handlers = getEventHandlers().get(eventType,
            () -> newArray(EventHandler.class));

    handlers.add(eventHandler);
}
项目:TechnicalAnalysisTool    文件:MenuCreator.java   
private EventHandler<ActionEvent> onDataUpdateAction(TatMain app, FinancialMarket fm, TatConfig config) {
return new EventHandler<ActionEvent>() {
    public void handle(ActionEvent event) {
        MenuItem mItem = (MenuItem) event.getSource();
        String cmdString = mItem.getText();
        if(cmdString.equalsIgnoreCase("Market data update...")) {
            Window ownerStage = primaryStage.getScene().getWindow();
            DataUpdateDialog dlg = new DataUpdateDialog(application, ownerStage, fm, config, true);
            dlg.sizeToScene();
            dlg.show();
         }
        }
    };
}
项目:WholesomeChat    文件:LoginController.java   
public void passStage(Stage stage) {
    this.stage = stage;
    stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
          public void handle(WindowEvent we) {
              System.out.println("Stage is closing");
              if (chatAccess != null && chatAccess.isConnected()) {
                    JsonObject str = new JsonObject();
                    str.addProperty("text", "/quit");
                    str.addProperty("intent", "message");
                    chatAccess.send(str.toString());
                    chatAccess.close();
              }
          }
    });
}
项目:incubator-netbeans    文件:HTMLEditorApp.java   
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setScene(new Scene(root));
    VBox vRoot = new VBox();

    vRoot.setPadding(new Insets(8, 8, 8, 8));
    vRoot.setSpacing(5);

    htmlEditor = new HTMLEditor();
    htmlEditor.setPrefSize(500, 245);
    htmlEditor.setHtmlText(INITIAL_TEXT);
    vRoot.getChildren().add(htmlEditor);

    final Label htmlLabel = new Label();
    htmlLabel.setMaxWidth(500);
    htmlLabel.setWrapText(true);

    ScrollPane scrollPane = new ScrollPane();
    scrollPane.getStyleClass().add("noborder-scroll-pane");
    scrollPane.setContent(htmlLabel);
    scrollPane.setFitToWidth(true);
    scrollPane.setPrefHeight(180);

    Button showHTMLButton = new Button("Show the HTML below");
    vRoot.setAlignment(Pos.CENTER);
    showHTMLButton.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent arg0) {
            htmlLabel.setText(htmlEditor.getHtmlText());
        }
    });

    vRoot.getChildren().addAll(showHTMLButton, scrollPane);
    root.getChildren().addAll(vRoot);
}
项目:incubator-netbeans    文件:WebViewBrowser.java   
public WebViewPane() {
    VBox.setVgrow(this, Priority.ALWAYS);
    setMaxWidth(Double.MAX_VALUE);
    setMaxHeight(Double.MAX_VALUE);

    WebView view = new WebView();
    view.setMinSize(500, 400);
    view.setPrefSize(500, 400);
    final WebEngine eng = view.getEngine();
    eng.load("http://www.oracle.com/us/index.html");
    final TextField locationField = new TextField("http://www.oracle.com/us/index.html");
    locationField.setMaxHeight(Double.MAX_VALUE);
    Button goButton = new Button("Go");
    goButton.setDefaultButton(true);
    EventHandler<ActionEvent> goAction = new EventHandler<ActionEvent>() {
        @Override public void handle(ActionEvent event) {
            eng.load(locationField.getText().startsWith("http://") ? locationField.getText() :
                    "http://" + locationField.getText());
        }
    };
    goButton.setOnAction(goAction);
    locationField.setOnAction(goAction);
    eng.locationProperty().addListener(new ChangeListener<String>() {
        @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
            locationField.setText(newValue);
        }
    });
    GridPane grid = new GridPane();
    grid.setVgap(5);
    grid.setHgap(5);
    GridPane.setConstraints(locationField, 0, 0, 1, 1, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.SOMETIMES);
    GridPane.setConstraints(goButton,1,0);
    GridPane.setConstraints(view, 0, 1, 2, 1, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.ALWAYS);
    grid.getColumnConstraints().addAll(
            new ColumnConstraints(100, 100, Double.MAX_VALUE, Priority.ALWAYS, HPos.CENTER, true),
            new ColumnConstraints(40, 40, 40, Priority.NEVER, HPos.CENTER, true)
    );
    grid.getChildren().addAll(locationField, goButton, view);
    getChildren().add(grid);
}
项目:Curriculum-design-of-data-structure    文件:Points2Controller.java   
private void bindBtStartEvents() {
    btStart.setOnMouseClicked(new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent event) {
            startGame();
        }
    });
}