Java 类javafx.scene.effect.BoxBlur 实例源码

项目:Hostel-Management-System    文件:MainProgramSceneController.java   
@FXML
private void changePasswordAction(ActionEvent event)
{
    mainTopAnchorPane.setEffect(new BoxBlur());
    passwordStage = new Stage();
    passwordStage.setOnCloseRequest(new EventHandler<WindowEvent>()
    {
        @Override
        public void handle(WindowEvent t)
        {
            mainTopAnchorPane.effectProperty().setValue(null);
        }
    });
    passwordStage.setTitle("Change Password");
    passwordStage.initModality(Modality.APPLICATION_MODAL);
    passwordStage.initStyle(StageStyle.UTILITY);
    passwordStage.setResizable(false);
    try
    {
        Parent passwordParent = FXMLLoader.load(getClass().getResource("changepassword.fxml"));
        passwordStage.setScene(new Scene(passwordParent));
        passwordStage.show();
    } catch (IOException ex)
    {
    }
}
项目:Hostel-Management-System    文件:MainProgramSceneController.java   
@FXML
private void activityLogButtonAction(ActionEvent event)
{
    mainTopAnchorPane.setEffect(new BoxBlur());
    passwordStage = new Stage();
    passwordStage.setOnCloseRequest(new EventHandler<WindowEvent>()
    {
        @Override
        public void handle(WindowEvent t)
        {
            mainTopAnchorPane.effectProperty().setValue(null);
        }
    });
    passwordStage.setTitle("Activity Log");
    passwordStage.initModality(Modality.APPLICATION_MODAL);
    passwordStage.initStyle(StageStyle.UTILITY);
    passwordStage.setResizable(false);
    try
    {
        Parent passwordParent = FXMLLoader.load(getClass().getResource("activityLog.fxml"));
        passwordStage.setScene(new Scene(passwordParent));
        passwordStage.show();
    } catch (IOException ex)
    {
    }
}
项目:Hostel-Management-System    文件:StudentDetailController.java   
@FXML
private void viewPayBillAction(ActionEvent event)
{
    MainProgramSceneController.mainTopAnchorPane.setEffect(new BoxBlur());
    billStage = new Stage();
    billStage.setOnCloseRequest(new EventHandler<WindowEvent>()
    {
        @Override
        public void handle(WindowEvent t)
        {
            MainProgramSceneController.mainTopAnchorPane.effectProperty().setValue(null);
        }
    });
    billStage.setTitle("View And Pay Due Bills");
    billStage.initModality(Modality.APPLICATION_MODAL);
    billStage.initStyle(StageStyle.UTILITY);
    billStage.setResizable(false);
    try
    {
        Parent passwordParent = FXMLLoader.load(getClass().getResource("viewPayBill.fxml"));
        billStage.setScene(new Scene(passwordParent));
        billStage.show();
    } catch (IOException ex)
    {
    }
}
项目:Library-Assistant    文件:AlertMaker.java   
public static void showMaterialDialog(StackPane root, Node nodeToBeBlurred, List<JFXButton> controls, String header, String body) {
    BoxBlur blur = new BoxBlur(3, 3, 3);

    JFXDialogLayout dialogLayout = new JFXDialogLayout();
    JFXDialog dialog = new JFXDialog(root, dialogLayout, JFXDialog.DialogTransition.TOP);

    controls.forEach(controlButton->{
        controlButton.getStyleClass().add("dialog-button");
        controlButton.addEventHandler(MouseEvent.MOUSE_CLICKED, (MouseEvent mouseEvent) -> {
            dialog.close();
        });
    });

    dialogLayout.setHeading(new Label(header));
    dialogLayout.setBody(new Label(body));
    dialogLayout.setActions(controls);
    dialog.show();
    dialog.setOnDialogClosed((JFXDialogEvent event1) -> {
        nodeToBeBlurred.setEffect(null);
    });
    nodeToBeBlurred.setEffect(blur);
}
项目:javafx-demos    文件:BlurEffectDemo.java   
private Node boxBlur() {
    Text t = new Text();
    t.setText("Blurry Text!");
    t.setFill(Color.RED);
    t.setFont(Font.font("null", FontWeight.BOLD, 36));
    t.setX(10);
    t.setY(40);

    BoxBlur bb = new BoxBlur();
    bb.setWidth(5);
    bb.setHeight(5);
    bb.setIterations(3);

    t.setEffect(bb);
    //t.setTranslateX(300);
    //t.setTranslateY(100);

    return t;
}
项目:narjillos    文件:MicroscopeView.java   
public Node toNode() {
    Vector screenSize = viewport.getSizeSC();
    if (screenSize.equals(currentScreenSize))
        return microscope;

    currentScreenSize = screenSize;

    double minScreenSize = Math.min(screenSize.x, screenSize.y);
    double maxScreenSize = Math.max(screenSize.x, screenSize.y);

    // Leave an ample left/bottom black margin - otherwise, the background
    // will be visible for a moment while enlarging the window.
    Rectangle black = new Rectangle(-10, -10, maxScreenSize + 1000, maxScreenSize + 1000);

    Circle hole = new Circle(screenSize.x / 2, screenSize.y / 2, minScreenSize / 2.03);
    microscope = Shape.subtract(black, hole);
    microscope.setEffect(new BoxBlur(5, 5, 1));

    return microscope;
}
项目:marathonv5    文件:AlphaMediaPlayer.java   
private static Group createViewer(final MediaPlayer player, final double scale, boolean blur) {
    Group mediaGroup = new Group();

    final MediaView mediaView = new MediaView(player);

    if (blur) {
        BoxBlur bb = new BoxBlur();
        bb.setWidth(4);
        bb.setHeight(4);
        bb.setIterations(1);
        mediaView.setEffect(bb);
    }

    double width = player.getMedia().getWidth();
    double height = player.getMedia().getHeight();

    mediaView.setFitWidth(width);
    mediaView.setTranslateX(-width/2.0); 
    mediaView.setScaleX(-scale);

    mediaView.setFitHeight(height);
    mediaView.setTranslateY(-height/2.0);
    mediaView.setScaleY(scale);

    mediaView.setDepthTest(DepthTest.ENABLE);
    mediaGroup.getChildren().add(mediaView);
    return mediaGroup;
}
项目:marathonv5    文件:AlphaMediaPlayer.java   
private static Group createViewer(final MediaPlayer player, final double scale, boolean blur) {
    Group mediaGroup = new Group();

    final MediaView mediaView = new MediaView(player);

    if (blur) {
        BoxBlur bb = new BoxBlur();
        bb.setWidth(4);
        bb.setHeight(4);
        bb.setIterations(1);
        mediaView.setEffect(bb);
    }

    double width = player.getMedia().getWidth();
    double height = player.getMedia().getHeight();

    mediaView.setFitWidth(width);
    mediaView.setTranslateX(-width/2.0); 
    mediaView.setScaleX(-scale);

    mediaView.setFitHeight(height);
    mediaView.setTranslateY(-height/2.0);
    mediaView.setScaleY(scale);

    mediaView.setDepthTest(DepthTest.ENABLE);
    mediaGroup.getChildren().add(mediaView);
    return mediaGroup;
}
项目:rpmjukebox    文件:AbstractModalView.java   
public void show(boolean blurBackground) {
    this.blurBackground = blurBackground;

    if (blurBackground) {
        owner.getScene().getRoot().setEffect(new BoxBlur());
    }

    stage.show();
}
项目:rpmjukebox    文件:MainPanelControllerTest.java   
@Test
public void shouldClickImportPlaylistButtonWithNullFile() throws Exception {
    MainPanelController spyMainPanelController = spy(mainPanelController);
    ListView<Playlist> playlistPanelListView = find("#playlistPanelListView");

    CountDownLatch latch = new CountDownLatch(1);

    ThreadRunner.runOnGui(() -> {
        playlistPanelListView.getItems().add(new Playlist(PLAYLIST_ID_SEARCH, "Search Playlist", 10));
        playlistPanelListView.getSelectionModel().select(0);
        latch.countDown();
    });

    latch.await(2000, TimeUnit.MILLISECONDS);

    FileChooser mockFileChooser = mock(FileChooser.class);
    when(mockFileChooser.getExtensionFilters()).thenReturn(FXCollections.observableArrayList());
    when(mockFileChooser.showOpenDialog(any())).thenReturn(null);
    doReturn(mockFileChooser).when(spyMainPanelController).constructFileChooser();

    CountDownLatch latch2 = new CountDownLatch(1);

    ThreadRunner.runOnGui(() -> {
        spyMainPanelController.handleImportPlaylistButtonAction(new ActionEvent());
        latch2.countDown();
    });

    latch2.await(2000, TimeUnit.MILLISECONDS);

    verify(mockPlaylistManager, never()).addPlaylist(any());
    verify(mockPlaylistManager, never()).getPlaylists();
    verify(mockRoot, times(1)).setEffect(Mockito.any(BoxBlur.class));
    verify(mockRoot, times(1)).setEffect(null);
}
项目:rpmjukebox    文件:MainPanelControllerTest.java   
@Test
public void shouldClickImportPlaylistButtonWhenExceptionThrown() throws Exception {
    MainPanelController spyMainPanelController = spy(mainPanelController);
    ListView<Playlist> playlistPanelListView = find("#playlistPanelListView");

    CountDownLatch latch = new CountDownLatch(1);

    ThreadRunner.runOnGui(() -> {
        playlistPanelListView.getItems().add(new Playlist(PLAYLIST_ID_SEARCH, "Search Playlist", 10));
        playlistPanelListView.getSelectionModel().select(0);
        latch.countDown();
    });

    latch.await(2000, TimeUnit.MILLISECONDS);

    FileChooser mockFileChooser = mock(FileChooser.class);
    when(mockFileChooser.getExtensionFilters()).thenReturn(FXCollections.observableArrayList());

    File mockFile = mock(File.class);
    when(mockFileChooser.showOpenDialog(any())).thenReturn(mockFile);
    doReturn(mockFileChooser).when(spyMainPanelController).constructFileChooser();

    doThrow(new RuntimeException("MainPanelControllerTest.shouldClickImportPlaylistButtonWhenExceptionThrown()"))
        .when(spyMainPanelController).constructFileReader(any());

    CountDownLatch latch2 = new CountDownLatch(1);

    ThreadRunner.runOnGui(() -> {
        spyMainPanelController.handleImportPlaylistButtonAction(new ActionEvent());
        latch2.countDown();
    });

    latch2.await(2000, TimeUnit.MILLISECONDS);

    verify(mockPlaylistManager, never()).addPlaylist(any());
    verify(mockPlaylistManager, never()).getPlaylists();
    verify(mockRoot, times(1)).setEffect(Mockito.any(BoxBlur.class));
    verify(mockRoot, times(1)).setEffect(null);
}
项目:Antipleurdawn    文件:BoardHandler.java   
private void displayOverlay()
{
    BoxBlur bb = new BoxBlur();
    bb.setWidth(5);
    bb.setHeight(5);
    bb.setIterations(1);

    scene.lookup("#main").setEffect(bb);
    scene.lookup("#overlay").setStyle("visibility: visible");
}
项目:truffle-hog    文件:BlurPane.java   
public BlurPane() {
    imageView = new ImageView();
    imageView.setFocusTraversable(false);
    BoxBlur bb = new BoxBlur();
    bb.setWidth(8);
    bb.setHeight(8);
    bb.setIterations(3);
    imageView.setEffect(bb);
}
项目:kotlinfx-ensemble    文件:AlphaMediaPlayer.java   
private static Group createViewer(final MediaPlayer player, final double scale, boolean blur) {
    Group mediaGroup = new Group();

    final MediaView mediaView = new MediaView(player);

    if (blur) {
        BoxBlur bb = new BoxBlur();
        bb.setWidth(4);
        bb.setHeight(4);
        bb.setIterations(1);
        mediaView.setEffect(bb);
    }

    double width = player.getMedia().getWidth();
    double height = player.getMedia().getHeight();

    mediaView.setFitWidth(width);
    mediaView.setTranslateX(-width/2.0); 
    mediaView.setScaleX(-scale);

    mediaView.setFitHeight(height);
    mediaView.setTranslateY(-height/2.0);
    mediaView.setScaleY(scale);

    mediaView.setDepthTest(DepthTest.ENABLE);
    mediaGroup.getChildren().add(mediaView);
    return mediaGroup;
}
项目:iTrySQL    文件:SourceFileDropTargetUtil.java   
/**
 * Setzt den Effekt, der zur Visualisierung eingesetzt wird, wenn ein Objekt
 * über dem DropTarget ist.
 *
 * @param node
 *            Knoten im Scene Graph, auf den der Effekt angewendet wird.
 */
private static void setDragEffect(final Node node) {
    node.setOpacity(DRAG_EFFECT_OPACITY_DURING_DRAG);
    // Blur-Effekt kann im Moment noch nicht in FX-CSS angegeben werden
    final BoxBlur bb = new BoxBlur();
    bb.setWidth(DRAG_EFFECT_WIDTH);
    bb.setHeight(DRAG_EFFECT_HEIGHT);
    bb.setIterations(DRAG_EFFECT_ITERATIONS);
    node.setEffect(bb);
}
项目:tokanagrammar-dev    文件:GUI.java   
/**
 * Blurs the main frame of the GUI (it's AnchorPane).
 */
public void blurOn(){
    AnchorPane mainScreen = Tokanagrammar.getAnchorPane();
    ObservableList<Node> screenComponents = mainScreen.getChildren();

    BoxBlur bb = new BoxBlur();
    bb.setIterations(3);
    for(Node node: screenComponents)
        node.effectProperty().set(bb);
}
项目:KenzieTheBot    文件:MainController.java   
@FXML
private void aboutNavButtonClicked(ActionEvent actionEvent) {

    System.out.println("{*} About button clicked.");

    BoxBlur boxBlur = new BoxBlur(2, 2, 3);

    JFXDialogLayout aboutDialogLayout = new JFXDialogLayout();

    aboutDialogLayout.setHeading(new Text("About"));
    aboutDialogLayout.setBody(new Text("Made by : Karan Pratap Singh\n\nLicenced to : @KPS"));

    aboutDialogLayout.setOpacity(1);
    aboutDialogLayout.setStyle("-fx-background-color: rgba(250,250,250,0.15)");
    aboutDialogLayout.setStyle("-fx-background-radius: 20%");
    aboutDialogLayout.applyCss();


    JFXDialog aboutDialog = new JFXDialog(backgroundStackPane,
            aboutDialogLayout,
            JFXDialog.DialogTransition.TOP);
    backgroundStackPane.setVisible(true);


    JFXButton aboutDialogButton = new JFXButton("ok");

    aboutDialog.setOnDialogOpened(
            (aboutDialogOpened) -> {

                System.out.println("{^} About dialog box opened.");
                aboutDialogButton.setOnAction((event) -> {

                    aboutDialog.close();
                    backgroundStackPane.setVisible(false);
                });

                aboutDialogLayout.setActions(aboutDialogButton);

                root.setStyle("-fx-border-color: black");
                backMedia.setEffect(boxBlur);
                recTextView.setEffect(boxBlur);
                startButton.setEffect(boxBlur);
            });

    aboutDialog.setOnDialogClosed(
            (aboutDialogClosed) -> {

                System.out.println("{^} About dialog box closed.");
                backMedia.setEffect(null);
                recTextView.setEffect(null);
                startButton.setEffect(null);
            });


    aboutDialog.show();
}
项目:rpmjukebox    文件:MainPanelController.java   
@FXML
protected void handleImportPlaylistButtonAction(ActionEvent event) {
    log.debug("Import playlist button pressed");

    FileChooser fileChooser = constructFileChooser();
    fileChooser.setTitle(messageManager.getMessage(MESSAGE_EXPORT_PLAYLIST_TITLE));
    fileChooser.getExtensionFilters()
        .add(new ExtensionFilter(
            messageManager.getMessage(MESSAGE_FILE_CHOOSER_PLAYLIST_FILTER, playlistExtensionFilter),
            playlistExtensionFilter));

    RpmJukebox.getStage().getScene().getRoot().setEffect(new BoxBlur());

    int currentPlaylistSelection = playlistPanelListView.getSelectionModel().getSelectedIndex();

    File file = fileChooser.showOpenDialog(RpmJukebox.getStage());

    if (file != null) {
        List<PlaylistSettings> playlists = null;

        try (FileReader fileReader = constructFileReader(file)) {
            playlists = settingsManager.getGson().fromJson(fileReader,
                new TypeToken<ArrayList<PlaylistSettings>>() {
                }.getType());

            if (playlists != null) {
                playlists.forEach(playlistSettings -> {
                    Playlist playlist = new Playlist(playlistSettings.getId(), playlistSettings.getName(),
                        maxPlaylistSize);

                    playlistSettings.getTracks().forEach(trackId -> {
                        Track track = searchManager.getTrackById(trackId);

                        if (track != null) {
                            playlist.addTrack(track);
                        }
                    });

                    playlistManager.addPlaylist(playlist);
                });

                // Update the observable lists
                updateObservablePlaylists();

                // Select the last selected playlist
                playlistPanelListView.getSelectionModel().select(currentPlaylistSelection);
                playlistPanelListView.getFocusModel().focus(currentPlaylistSelection);
            }
        } catch (Exception e) {
            log.error("Unable to import playlists file - {}", file.getAbsolutePath(), e);

            RpmJukebox.getStage().getScene().getRoot().setEffect(null);

            return;
        }
    }

    RpmJukebox.getStage().getScene().getRoot().setEffect(null);
}
项目:rpmjukebox    文件:MainPanelControllerTest.java   
@Test
public void shouldClickImportPlaylistButton() throws Exception {
    MainPanelController spyMainPanelController = spy(mainPanelController);
    ListView<Playlist> playlistPanelListView = find("#playlistPanelListView");

    CountDownLatch latch1 = new CountDownLatch(1);

    ThreadRunner.runOnGui(() -> {
        playlistPanelListView.getItems().add(new Playlist(PLAYLIST_ID_SEARCH, "Search Playlist", 10));
        playlistPanelListView.getSelectionModel().select(0);
        latch1.countDown();
    });

    latch1.await(2000, TimeUnit.MILLISECONDS);

    FileChooser mockFileChooser = mock(FileChooser.class);
    when(mockFileChooser.getExtensionFilters()).thenReturn(FXCollections.observableArrayList());

    File mockFile = mock(File.class);
    when(mockFileChooser.showOpenDialog(any())).thenReturn(mockFile);
    doReturn(mockFileChooser).when(spyMainPanelController).constructFileChooser();

    FileReader mockFileReader = mock(FileReader.class);
    doReturn(mockFileReader).when(spyMainPanelController).constructFileReader(any());

    Gson mockGson = mock(Gson.class);
    when(mockSettingsManager.getGson()).thenReturn(mockGson);

    Playlist playlist = new Playlist(1, "Playlist", 10);
    for (int i = 0; i < 10; i++) {
        Track mockTrack = mock(Track.class);
        when(mockTrack.getTrackId()).thenReturn(Integer.toString(i));

        playlist.addTrack(mockTrack);
        when(mockSearchManager.getTrackById(Integer.toString(i))).thenReturn(mockTrack);
    }

    List<PlaylistSettings> playlistSettings = new ArrayList<>();
    playlistSettings.add(new PlaylistSettings(playlist));

    when(mockGson.fromJson(Mockito.any(FileReader.class), Mockito.any(Type.class))).thenReturn(playlistSettings);

    CountDownLatch latch2 = new CountDownLatch(1);

    ThreadRunner.runOnGui(() -> {
        spyMainPanelController.handleImportPlaylistButtonAction(new ActionEvent());
        latch2.countDown();
    });

    latch2.await(2000, TimeUnit.MILLISECONDS);

    ArgumentCaptor<Playlist> playlistCaptor = ArgumentCaptor.forClass(Playlist.class);

    verify(mockPlaylistManager, times(1)).addPlaylist(playlistCaptor.capture());

    Playlist result = playlistCaptor.getValue();

    assertThat("Playlist should be the same as the input playlist", result, equalTo(playlist));
    assertThat("Playlist should have the same number of tracks as the input playlist", result.getTracks(),
        hasSize(playlist.getTracks().size()));

    verify(mockPlaylistManager, times(1)).getPlaylists();
    verify(mockRoot, times(1)).setEffect(Mockito.any(BoxBlur.class));
    verify(mockRoot, times(1)).setEffect(null);
}
项目:rpmjukebox    文件:MainPanelControllerTest.java   
@Test
public void shouldClickImportPlaylistButtonWithNullTracksFromSearch() throws Exception {
    MainPanelController spyMainPanelController = spy(mainPanelController);
    ListView<Playlist> playlistPanelListView = find("#playlistPanelListView");

    CountDownLatch latch = new CountDownLatch(1);

    ThreadRunner.runOnGui(() -> {
        playlistPanelListView.getItems().add(new Playlist(PLAYLIST_ID_SEARCH, "Search Playlist", 10));
        playlistPanelListView.getSelectionModel().select(0);
        latch.countDown();
    });

    latch.await(2000, TimeUnit.MILLISECONDS);

    FileChooser mockFileChooser = mock(FileChooser.class);
    when(mockFileChooser.getExtensionFilters()).thenReturn(FXCollections.observableArrayList());

    File mockFile = mock(File.class);
    when(mockFileChooser.showOpenDialog(any())).thenReturn(mockFile);
    doReturn(mockFileChooser).when(spyMainPanelController).constructFileChooser();

    FileReader mockFileReader = mock(FileReader.class);
    doReturn(mockFileReader).when(spyMainPanelController).constructFileReader(any());

    Gson mockGson = mock(Gson.class);
    when(mockSettingsManager.getGson()).thenReturn(mockGson);

    Playlist playlist = new Playlist(1, "Playlist", 10);
    for (int i = 0; i < 10; i++) {
        Track mockTrack = mock(Track.class);
        when(mockTrack.getTrackId()).thenReturn(Integer.toString(i));

        playlist.addTrack(mockTrack);
    }

    List<PlaylistSettings> playlistSettings = new ArrayList<>();
    playlistSettings.add(new PlaylistSettings(playlist));

    when(mockGson.fromJson(Mockito.any(FileReader.class), Mockito.any(Type.class))).thenReturn(playlistSettings);
    when(mockSearchManager.getTrackById(any())).thenReturn(null);

    CountDownLatch latch2 = new CountDownLatch(1);

    ThreadRunner.runOnGui(() -> {
        spyMainPanelController.handleImportPlaylistButtonAction(new ActionEvent());
        latch2.countDown();
    });

    latch2.await(2000, TimeUnit.MILLISECONDS);

    ArgumentCaptor<Playlist> playlistCaptor = ArgumentCaptor.forClass(Playlist.class);

    verify(mockPlaylistManager, times(1)).addPlaylist(playlistCaptor.capture());

    Playlist result = playlistCaptor.getValue();

    assertThat("Playlist should be the same as the input playlist", result, equalTo(playlist));
    assertThat("Playlist should have no tracks", result.getTracks(), empty());

    verify(mockPlaylistManager, times(1)).getPlaylists();
    verify(mockRoot, times(1)).setEffect(Mockito.any(BoxBlur.class));
    verify(mockRoot, times(1)).setEffect(null);
}
项目:rpmjukebox    文件:MainPanelControllerTest.java   
@Test
public void shouldClickImportPlaylistButtonWithNullPlaylistSettings() throws Exception {
    MainPanelController spyMainPanelController = spy(mainPanelController);
    ListView<Playlist> playlistPanelListView = find("#playlistPanelListView");

    CountDownLatch latch = new CountDownLatch(1);

    ThreadRunner.runOnGui(() -> {
        playlistPanelListView.getItems().add(new Playlist(PLAYLIST_ID_SEARCH, "Search Playlist", 10));
        playlistPanelListView.getSelectionModel().select(0);
        latch.countDown();
    });

    latch.await(2000, TimeUnit.MILLISECONDS);

    FileChooser mockFileChooser = mock(FileChooser.class);
    when(mockFileChooser.getExtensionFilters()).thenReturn(FXCollections.observableArrayList());

    File mockFile = mock(File.class);
    when(mockFileChooser.showOpenDialog(any())).thenReturn(mockFile);
    doReturn(mockFileChooser).when(spyMainPanelController).constructFileChooser();

    FileReader mockFileReader = mock(FileReader.class);
    doReturn(mockFileReader).when(spyMainPanelController).constructFileReader(any());

    Gson mockGson = mock(Gson.class);
    when(mockSettingsManager.getGson()).thenReturn(mockGson);
    when(mockGson.fromJson(Mockito.any(FileReader.class), Mockito.any(Type.class))).thenReturn(null);

    CountDownLatch latch2 = new CountDownLatch(1);

    ThreadRunner.runOnGui(() -> {
        spyMainPanelController.handleImportPlaylistButtonAction(new ActionEvent());
        latch2.countDown();
    });

    latch2.await(2000, TimeUnit.MILLISECONDS);

    verify(mockPlaylistManager, never()).addPlaylist(any());
    verify(mockPlaylistManager, never()).getPlaylists();
    verify(mockRoot, times(1)).setEffect(Mockito.any(BoxBlur.class));
    verify(mockRoot, times(1)).setEffect(null);
}
项目:livro-javafx-pratico    文件:DesenhandoComCanvas.java   
@Override
public void start(Stage palco) throws Exception {
    // O construtor do Canvas recebe a largura e a altura
    Canvas canvas = new Canvas(300, 300);
    // O objeto principal do Canvas é o GraphicsContext, que usamos para desenhar
    GraphicsContext ctx = canvas.getGraphicsContext2D();
    // estamos prontos para desenhar coisas! Vamos começar mudando a cor
    ctx.setFill(Color.RED);
    // podemos configurar uma fonte para os textos
    ctx.setFont(Font.font("Serif", FontWeight.BOLD, 25));
    // desenhando um texto, o primeiro param é o texto, os seguintes são a pos X e Y
    ctx.fillText("Olá Mundo Canvas", 15, 30);
    // podemos configurar efeitos e novamente trocar a cor
    ctx.setFill(Color.BLUE);
    ctx.setEffect(new BoxBlur());
    ctx.fillText("Olá Mundo Canvas", 15, 60);
    // agora vamos trocar o efeito, cor e desenhar um retângulo(x,y, largura, altura)
    ctx.setEffect(new Reflection());
    ctx.setFill(Color.AQUA);
    ctx.fillRect(15, 90, 240, 20);
    // ou um retângulo sem preenchimento
    ctx.setStroke(Color.GREEN);
    ctx.strokeRect(15, 135, 240, 30);
    // ou circulos (forma oval)
    ctx.setEffect(null);
    ctx.setFill(Color.BROWN);
    ctx.fillOval(15, 175, 90, 25);
    ctx.setStroke(Color.YELLOWGREEN);
    // ou formas ovais sem preenchimento
    ctx.strokeOval(160, 175, 90, 25);
    // ou até desenhar uns poligonos locos, usando diversos pontos X e Y
    double xs[] = {15, 30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180, 195, 210, 225, 240, 255, 270};
    double ys[] = {205, 235, 250, 265, 205, 235, 205, 205, 235, 250, 265, 205, 235, 205, 205, 235, 250, 205};
    ctx.setFill(Color.MAGENTA);
    ctx.setEffect(new Reflection());
    ctx.fillPolygon(xs, ys, 18);
    Scene cena = new Scene(new StackPane(canvas), 800, 600);
    palco.setTitle("Canvas");
    palco.setScene(cena);
    palco.show();
}
项目:mars-sim    文件:FrostedPanel.java   
public FrostedPanel(Dash dash)
{
    this.dash = dash;
    view = new ImageView();

    view.setLayoutX(0);
    view.setLayoutY(0);

    view.fitWidthProperty().bind(prefWidthProperty());
    view.fitHeightProperty().bind(prefHeightProperty());

    view.setEffect(new BoxBlur(15, 15, 20));
    view.setPreserveRatio(false);

    getChildren().add(view);
    setStyle("-fx-background-color:rgba(0,0,0,0);");

    setPrefWidth(300);
    setPrefHeight(300);

    setLayoutX(70);
    setLayoutY(10);

    translucent = new Pane();
    translucent.setLayoutX(0);
    translucent.setLayoutY(0);

    translucent.prefWidthProperty().bind(prefWidthProperty());
    translucent.prefHeightProperty().bind(prefHeightProperty());
    translucent.setStyle("-fx-background-color:rgba(0,0,0,0.5);");

    Label label;
    label = new Label("Frosted panel");
    label.setLayoutX(10);
    label.setLayoutY(10);
    label.setTextFill(Color.WHITE);

    getChildren().add(translucent);
    getChildren().add(label);
    startTimer();

    setOnMouseDragged(e ->
    {
        double x, y;
        x = (e.getSceneX() < 0) ? 0 : e.getSceneX();
        y = (e.getSceneY() < 0) ? 0 : e.getSceneY();


        setLayoutX(x);
        setLayoutY(y);

    });
}
项目:narjillos    文件:EnvironmentView.java   
private Effect getBlurEffect(double zoomLevel) {
    int blurAmount = Math.min((int) (15 * (zoomLevel - 0.7)), 10);
    return new BoxBlur(blurAmount, blurAmount, 1);
}
项目:jutility-javafx    文件:ErrorIcon.java   
private void resize() {

        final double size = this.getWidth() < this.getHeight() ? this
                .getWidth() : this.getHeight();

        final double halfSize = size / 2.0;


        final double width = size * this.rectangleXRatio;
        final double height = size * this.rectangleYRatio;

        final double centerX = (size - width) / 2.0;
        final double centerY = (size - height) / 2.0;

        this.frame.setRadius(halfSize);
        this.frame.setCenterX(halfSize);
        this.frame.setCenterY(halfSize);


        this.frame1.setRadius(this.frame1Ratio * halfSize);
        this.frame1.setCenterX(halfSize);
        this.frame1.setCenterY(halfSize);

        this.shadow.setOffsetX(size * this.shadowXOffset);
        this.shadow.setOffsetY(size * this.shadowYOffset);
        this.shadow.setRadius(size * this.shadowSizeOffset);
        this.shadow.setSpread(0.099);

        this.frame2.setRadius(this.frame2Ratio * halfSize);
        this.frame2.setLayoutX(halfSize);
        this.frame2.setLayoutY(halfSize);

        this.r1.setWidth(width);
        this.r1.setHeight(height);
        this.r1.setX(centerX);
        this.r1.setY(centerY);
        this.r1.setArcHeight(height / 2.0);
        this.r1.setArcWidth(width / 2.0);

        this.r2.setWidth(width);
        this.r2.setHeight(height);
        this.r2.setX(centerX);
        this.r2.setY(centerY);
        this.r2.setArcHeight(height / 2.0);
        this.r2.setArcWidth(width / 2.0);

        this.r3.setWidth(width);
        this.r3.setHeight(height);
        this.r3.setX(centerX);
        this.r3.setY(centerY);
        this.r3.setArcHeight(height / 2.0);
        this.r3.setArcWidth(width / 2.0);

        this.lightEffect.setRotate(this.lightEffectRotate);
        this.lightEffect.setTranslateX(this.lightEffectXRatio * size);
        this.lightEffect.setTranslateY(this.lightEffectYRatio * size);
        this.lightEffect.setRadiusX(this.lightEffectXRadiusRatio * size);
        this.lightEffect.setRadiusY(this.lightEffectYRadiusRatio * size);

        if (this.lightEffect.getEffect() instanceof BoxBlur) {

            final BoxBlur blur = (BoxBlur) this.lightEffect.getEffect();

            blur.setHeight(0.25 * size);
            blur.setWidth(0.25 * size);
        }
    }