當前位置: 首頁>>代碼示例>>Java>>正文


Java Popup.show方法代碼示例

本文整理匯總了Java中javafx.stage.Popup.show方法的典型用法代碼示例。如果您正苦於以下問題:Java Popup.show方法的具體用法?Java Popup.show怎麽用?Java Popup.show使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.stage.Popup的用法示例。


在下文中一共展示了Popup.show方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onMouseClickedShowItemMenuPopup

import javafx.stage.Popup; //導入方法依賴的package包/類
public void onMouseClickedShowItemMenuPopup(MouseEvent event) {
    LoggerFacade.INSTANCE.debug(this.getClass(), "On mouse clicked show ItemMenu popup"); // NOI18N
    
    if (!event.getButton().equals(MouseButton.SECONDARY)) {
        return;
    }
    
    final Popup popup = new Popup();
    popup.setAutoFix(true);
    popup.setAutoHide(true);
    popup.setHideOnEscape(true);
    
    final ItemMenuPopupView view = new ItemMenuPopupView();
    final ItemMenuPopupPresenter presenter = view.getRealPresenter();
    presenter.configure(popup, model);
    popup.getContent().add(view.getView());
    
    popup.show(parent, event.getScreenX(), event.getScreenY());
}
 
開發者ID:Naoghuman,項目名稱:Incubator,代碼行數:20,代碼來源:ProjectItemPresenter.java

示例2: handleContextHelpButtonAction

import javafx.stage.Popup; //導入方法依賴的package包/類
@FXML
private void handleContextHelpButtonAction(ActionEvent event) {
 final Popup popup = new Popup();

  Tab activeTab = TabSelectionChangeListener.getActiveTab();
  if (activeTab == null || activeTab.getUserData() == null) {
    return;
  }
  // The help text is currently stored in userData.
  // TODO(gaborfeher): Find a better place.
  String helpText = (String) activeTab.getUserData();
  Label popupLabel = new Label(helpText);
  popupLabel.setStyle("-fx-border-color: black;");
  popup.setAutoHide(true);
  popup.setAutoFix(true);
  // Calculate popup placement coordinates.
  Node eventSource = (Node) event.getSource();
  Bounds sourceNodeBounds = eventSource.localToScreen(eventSource.getBoundsInLocal());
  popup.setX(sourceNodeBounds.getMinX() - 5.0);
  popup.setY(sourceNodeBounds.getMaxY() + 5.0);
  popup.getContent().addAll(popupLabel);
  popup.show(stage);
}
 
開發者ID:gaborfeher,項目名稱:grantmaster,代碼行數:24,代碼來源:MainPageController.java

示例3: showEmployeesHelper

import javafx.stage.Popup; //導入方法依賴的package包/類
@FXML
public void showEmployeesHelper(ActionEvent evt) {
	
	Button btn = (Button)evt.getSource();
	
	Point2D point = btn.localToScreen(0.0d + btn.getWidth(), 0.0d - btn.getHeight());
	
	try {
		
		Popup employeesHelper = new ListViewHelperEmployeesPopup(tfEmployee, point);
		
		employeesHelper.show(btn.getScene().getWindow());
	
	} catch(Exception exc) {
		exc.printStackTrace();
		Alert alert = new Alert(AlertType.ERROR, "Error creating employees popup; exiting");
		alert.showAndWait();
		btn.getScene().getWindow().hide();  // close and implicit exit
	}
}
 
開發者ID:bekwam,項目名稱:examples-javafx-repos1,代碼行數:21,代碼來源:ListViewHelperMainController.java

示例4: CardPlayedToken

import javafx.stage.Popup; //導入方法依賴的package包/類
public CardPlayedToken(GameBoardView boardView, Card card) {
	Window parent = boardView.getScene().getWindow();
	this.cardToken = new CardTooltip();

	popup = new Popup();
	popup.getContent().setAll(cardToken);
	popup.setX(parent.getX() + 40);
	popup.show(parent);
	popup.setY(parent.getY() + parent.getHeight() * 0.5 - cardToken.getHeight() * 0.5);

	cardToken.setCard(card);

	NotificationProxy.sendNotification(GameNotification.ANIMATION_STARTED);
	FadeTransition animation = new FadeTransition(Duration.seconds(1.2), cardToken);
	animation.setDelay(Duration.seconds(0.6f));
	animation.setOnFinished(this::onComplete);
	animation.setFromValue(1);
	animation.setToValue(0);
	animation.play();
}
 
開發者ID:demilich1,項目名稱:metastone,代碼行數:21,代碼來源:CardPlayedToken.java

示例5: CardRevealedToken

import javafx.stage.Popup; //導入方法依賴的package包/類
public CardRevealedToken(GameBoardView boardView, Card card, double delay) {
	Window parent = boardView.getScene().getWindow();
	this.cardToken = new CardTooltip();

	popup = new Popup();
	popup.getContent().setAll(cardToken);
	popup.setX(parent.getX() + 40);
	popup.show(parent);
	popup.setY(parent.getY() + parent.getHeight() * 0.5 - cardToken.getHeight() * 0.5);

	cardToken.setCard(card);
	NotificationProxy.sendNotification(GameNotification.ANIMATION_STARTED);
	FadeTransition animation = new FadeTransition(Duration.seconds(delay), cardToken);
	animation.setOnFinished(this::secondTransition);
	animation.setFromValue(0);
	animation.setToValue(0);
	animation.play();
}
 
開發者ID:demilich1,項目名稱:metastone,代碼行數:19,代碼來源:CardRevealedToken.java

示例6: start

import javafx.stage.Popup; //導入方法依賴的package包/類
/**
 * Method to load the viewplayer popup
 * @param inputPlayer player to be displayed in the popup
 * @throws IOException is thrown if the FXML file cannot be parsed.
 */
public static void start(Player inputPlayer) throws IOException {
	player = inputPlayer;
	if(player != null){
		FXMLLoader loader = new FXMLLoader();
		loader.setLocation(Class.class
			.getResource("/data/gui/pages-game/ViewPlayer.fxml"));
		page = (AnchorPane) loader.load();
		FadeTransition ft = new FadeTransition(Duration.millis(900), page);
		ft.setFromValue(0.0);
		ft.setToValue(0.97);
		ft.play();
		popup = new Popup();
		popup.setAutoHide(true);
		popup.getContent().add(page);
		popup.show(Main.stage);
	}
}
 
開發者ID:notcomment,項目名稱:UFMGame,代碼行數:23,代碼來源:ViewPlayer.java

示例7: start

import javafx.stage.Popup; //導入方法依賴的package包/類
/**
 * THe start method to load the Save game dialog
 * @throws IOException is thrown if the FXML file cannot be parsed.
 */
public static void start() throws IOException {
	FXMLLoader loader = new FXMLLoader();
	loader.setLocation(Class.class
			.getResource("/data/gui/pages-game/SaveGameDialog.fxml"));
	page = (AnchorPane) loader.load();
	FadeTransition ft = new FadeTransition(Duration.millis(900), page);
	ft.setFromValue(0.0);
	ft.setToValue(0.97);
	ft.play();
	page.setOpacity(0.85);
	popup = new Popup();
	popup.setAutoHide(true);
	popup.getContent().add(page);
	popup.show(Main.stage);
}
 
開發者ID:notcomment,項目名稱:UFMGame,代碼行數:20,代碼來源:SaveGameController.java

示例8: start

import javafx.stage.Popup; //導入方法依賴的package包/類
/**
 * Creates the popup screen and displays it
 */
public static void start(){
	FXMLLoader loader = new FXMLLoader();
	loader.setLocation(Class.class
			.getResource("/data/gui/pages-game/Popup.fxml"));
	try {
		page = (AnchorPane) loader.load();
	} catch (IOException e) {
		e.printStackTrace();
	}
	FadeTransition ft = new FadeTransition(Duration.millis(900), page);
	ft.setFromValue(0.0);
	ft.setToValue(0.97);
	ft.play();
	popup = new Popup();
	popup.setAutoHide(true);
	popup.getContent().add(page);
	popup.show(Main.stage);
}
 
開發者ID:notcomment,項目名稱:UFMGame,代碼行數:22,代碼來源:Popupscreen.java

示例9: start

import javafx.stage.Popup; //導入方法依賴的package包/類
/**
 * THe start method to load the are you sure to overwrite dialog
 * 
 * @param slot
 *            in where is game is saved
 * 
 * @throws IOException
 *             is thrown if the FXML file cannot be parsed.
 */
public static void start(int slot) throws IOException {
	saveslot = slot;
	FXMLLoader loader = new FXMLLoader();
	loader.setLocation(Class.class
			.getResource("/data/gui/pages-game/OverwriteDialog.fxml"));
	page = (AnchorPane) loader.load();
	FadeTransition ft = new FadeTransition(Duration.millis(900), page);
	ft.setFromValue(0.0);
	ft.setToValue(0.97);
	ft.play();
	page.setOpacity(0.85);
	popup = new Popup();
	popup.setAutoHide(true);
	popup.getContent().add(page);
	popup.show(Main.stage);
}
 
開發者ID:notcomment,項目名稱:UFMGame,代碼行數:26,代碼來源:OverwriteController.java

示例10: start

import javafx.stage.Popup; //導入方法依賴的package包/類
/**
 * Loads the result of a round dialog
 * @throws IOException is thrown if the FXML file cannot be parsed.
 */
public static void start() throws IOException{
	FXMLLoader loader = new FXMLLoader();
	loader.setLocation(Class.class
			.getResource("/data/gui/pages-game/ResultRoundDialog.fxml"));
	page = (AnchorPane) loader.load();
	FadeTransition ft = new FadeTransition(Duration.millis(900), page);
	ft.setFromValue(0.0);
	ft.setToValue(0.97);
	ft.play();
	popup = new Popup();
	popup.setAutoHide(true);
	page.setOpacity(0.85);
	popup.getContent().add(page);
	popup.show(Main.stage);
	TeamBuilderController.start();
}
 
開發者ID:notcomment,項目名稱:UFMGame,代碼行數:21,代碼來源:ResultRoundDialogcontroller.java

示例11: start

import javafx.stage.Popup; //導入方法依賴的package包/類
/**
 * THe start method to load the loadgame dialog
 * @throws IOException is thrown if the FXML file cannot be parsed.
 */
public static void start() throws IOException {
	FXMLLoader loader = new FXMLLoader();
	loader.setLocation(Class.class
			.getResource("/data/gui/pages-menu/LoadGameDialog.fxml"));
	page = (AnchorPane) loader.load();
	FadeTransition ft = new FadeTransition(Duration.millis(900), page);
	ft.setFromValue(0.0);
	ft.setToValue(0.97);
	ft.play();
	
	page.setOpacity(0.85);
	popup = new Popup();
	popup.setAutoHide(true);
	popup.getContent().add(page);
	popup.show(Main.stage);
}
 
開發者ID:notcomment,項目名稱:UFMGame,代碼行數:21,代碼來源:LoadGameController.java

示例12: showPopupWithinBounds

import javafx.stage.Popup; //導入方法依賴的package包/類
public void showPopupWithinBounds(final Node node, final Popup popup) {
	final Window window = node.getScene().getWindow();
	double x = window.getX() + node.localToScene(0, 0).getX() + node.getScene().getX();
	double y = window.getY() + node.localToScene(0, 0).getY() + node.getScene().getY() + node.getBoundsInParent().getHeight();
	popup.show(window, x, y);
	if (!popup.getContent().isEmpty()) {
		final Node content = popup.getContent().get(0);
		x -= content.localToScene(0, 0).getX();
		y -= content.localToScene(0, 0).getY();
	}
	Point2D pd= new Point2D(x, y);
	
	double Z = window.getX();
	double gX = sp.getLayoutX();
	double c = sp.getWidth()-popup.getWidth();
	
	popup.show(window, (Z+gX+c+8), y);
}
 
開發者ID:SaiPradeepDandem,項目名稱:javafx-demos,代碼行數:19,代碼來源:PopUpPositioningDemo.java

示例13: showPopUp

import javafx.stage.Popup; //導入方法依賴的package包/類
public Point2D showPopUp(final Node node, final Popup popup){
		final Parent parent = node.getParent();
		final Bounds childBounds = node.getBoundsInParent();

		double x = 0;
		double y = 0;
		if (null != parent) {
			final Bounds parentBounds = parent.localToScene(parent.getBoundsInLocal());
			x = childBounds.getMinX() + parentBounds.getMinX() + parent.getScene().getX()
					+ parent.getScene().getWindow().getX();
			y = childBounds.getMaxY() + parentBounds.getMinY() + parent.getScene().getY()
					+ parent.getScene().getWindow().getY();
		}

		Point2D pd= new Point2D(x, y);
		popup.show(node, x, y);
		return pd;
	
}
 
開發者ID:SaiPradeepDandem,項目名稱:javafx-demos,代碼行數:20,代碼來源:PopUpPositioningDemo.java

示例14: showGameOverPopup

import javafx.stage.Popup; //導入方法依賴的package包/類
/**
 * shows game-over pop-up.
 * @param controller 
 */
private void showGameOverPopup(MainFXMLDocumentController controller) {
	@SuppressWarnings("deprecation")
	BorderPane content =BorderPaneBuilder.create()
		 .minWidth(230).minHeight(130)
		 .bottom(getBottomBox(controller))
		 .center(getCenterBox())
		 .style(              "-fx-background-color:linear-gradient(darkslategrey, wheat, white);"
			  + "-fx-background-radius:7;"
			  + "-fx-border-radius:7")
		 .build();
	pp = new Popup();
	pp.setAutoHide(true);
	pp.getContent().add(content);
	pp.show(controller.DOWN.getScene().getWindow());
}
 
開發者ID:ShekkarRaee,項目名稱:xpanderfx,代碼行數:20,代碼來源:GameOver.java

示例15: showPopup

import javafx.stage.Popup; //導入方法依賴的package包/類
protected void showPopup() {
	init();
	
	isShowing = true;
   	
       VBox popupLayout = new VBox();
       popupLayout.setSpacing(10);
       popupLayout.setPadding(new Insets(10, 10, 10, 10));

       StackPane popupContent = new StackPane();
       popupContent.setPrefSize(width, height);
       popupContent.getStyleClass().add("notification");
       popupContent.getChildren().addAll(popupLayout);

       popup = new Popup();
       popup.setX(getX());
       popup.setY(getY());
       popup.getContent().add(popupContent);
       popup.addEventHandler(MouseEvent.MOUSE_PRESSED, new WeakEventHandler<>(event -> {
           fireNotificationEvent(new NotificationEvent(this, popup, NotificationEvent.NOTIFICATION_PRESSED));
           hidePopUp();
       }));            
       popups.add(popup);

       // Add a timeline for popup fade out
       KeyValue fadeOutBegin = new KeyValue(popup.opacityProperty(), 1.0);            
       KeyValue fadeOutEnd   = new KeyValue(popup.opacityProperty(), 0.0);

       KeyFrame kfBegin = new KeyFrame(Duration.ZERO, fadeOutBegin);
       KeyFrame kfEnd   = new KeyFrame(popupAnimationTime, fadeOutEnd);

       timeline = new Timeline(kfBegin, kfEnd);
       timeline.setDelay(popupLifetime);
       timeline.setOnFinished(actionEvent -> Platform.runLater(() -> {
       	hidePopUp();
       }));
       
       if (stage.isShowing()) {
           stage.toFront();
       } else {
           stage.show();
       }

       popup.show(stage);
       fireNotificationEvent(new NotificationEvent(this, popup, NotificationEvent.SHOW_NOTIFICATION));
       timeline.play();
}
 
開發者ID:Team-Sprout,項目名稱:Clipcon-Client,代碼行數:48,代碼來源:ClipboardNotification.java


注:本文中的javafx.stage.Popup.show方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。