本文整理汇总了Java中javafx.scene.effect.BoxBlur类的典型用法代码示例。如果您正苦于以下问题:Java BoxBlur类的具体用法?Java BoxBlur怎么用?Java BoxBlur使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BoxBlur类属于javafx.scene.effect包,在下文中一共展示了BoxBlur类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: changePasswordAction
import javafx.scene.effect.BoxBlur; //导入依赖的package包/类
@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)
{
}
}
示例2: activityLogButtonAction
import javafx.scene.effect.BoxBlur; //导入依赖的package包/类
@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)
{
}
}
示例3: viewPayBillAction
import javafx.scene.effect.BoxBlur; //导入依赖的package包/类
@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)
{
}
}
示例4: showMaterialDialog
import javafx.scene.effect.BoxBlur; //导入依赖的package包/类
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);
}
示例5: boxBlur
import javafx.scene.effect.BoxBlur; //导入依赖的package包/类
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;
}
示例6: toNode
import javafx.scene.effect.BoxBlur; //导入依赖的package包/类
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;
}
示例7: createViewer
import javafx.scene.effect.BoxBlur; //导入依赖的package包/类
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;
}
示例8: show
import javafx.scene.effect.BoxBlur; //导入依赖的package包/类
public void show(boolean blurBackground) {
this.blurBackground = blurBackground;
if (blurBackground) {
owner.getScene().getRoot().setEffect(new BoxBlur());
}
stage.show();
}
示例9: shouldClickImportPlaylistButtonWithNullFile
import javafx.scene.effect.BoxBlur; //导入依赖的package包/类
@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);
}
示例10: shouldClickImportPlaylistButtonWhenExceptionThrown
import javafx.scene.effect.BoxBlur; //导入依赖的package包/类
@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);
}
示例11: displayOverlay
import javafx.scene.effect.BoxBlur; //导入依赖的package包/类
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");
}
示例12: BlurPane
import javafx.scene.effect.BoxBlur; //导入依赖的package包/类
public BlurPane() {
imageView = new ImageView();
imageView.setFocusTraversable(false);
BoxBlur bb = new BoxBlur();
bb.setWidth(8);
bb.setHeight(8);
bb.setIterations(3);
imageView.setEffect(bb);
}
示例13: setDragEffect
import javafx.scene.effect.BoxBlur; //导入依赖的package包/类
/**
* 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);
}
示例14: blurOn
import javafx.scene.effect.BoxBlur; //导入依赖的package包/类
/**
* 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);
}
示例15: aboutNavButtonClicked
import javafx.scene.effect.BoxBlur; //导入依赖的package包/类
@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();
}