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


Java Popup類代碼示例

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


Popup類屬於javafx.stage包,在下文中一共展示了Popup類的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: createHideTimeline

import javafx.stage.Popup; //導入依賴的package包/類
private Timeline createHideTimeline(final Popup popup, NotificationBar bar, final Pos p, Duration startDelay) {
	KeyValue fadeOutBegin = new KeyValue(bar.opacityProperty(), 1.0);
	KeyValue fadeOutEnd = new KeyValue(bar.opacityProperty(), 0.0);

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

	Timeline timeline = new Timeline(kfBegin, kfEnd);
	timeline.setDelay(startDelay);
	timeline.setOnFinished(new EventHandler<ActionEvent>() {
		@Override
		public void handle(ActionEvent e) {
			hide(popup, p);
		}
	});

	return timeline;
}
 
開發者ID:callakrsos,項目名稱:Gargoyle,代碼行數:19,代碼來源:GargoyleNotification.java

示例3: createPopup

import javafx.stage.Popup; //導入依賴的package包/類
protected PopupWindow createPopup() {
	ListView<BODTO<T>> listView = new ListView<>();
	listView.getStyleClass().addAll("combo-box-popup");
	listView.setItems(completionItems);
	listView.cellFactoryProperty().bind(control.cellFactoryProperty());
	listView.setOnKeyReleased(e -> { 
		if (e.getCode() == KeyCode.ENTER ) { select(listView); e.consume(); }
		if (e.getCode() == KeyCode.ESCAPE ) { hidePopup(); e.consume(); }
	});
	
	listView.setOnMouseClicked(e -> { if (e.getClickCount() == 1) select(listView); e.consume();});
	
	Popup popup = new Popup();
	control.showPopup.bind(popup.showingProperty());
	popup.getContent().add(listView);
	textInput.updateValue("");
	return popup;
}
 
開發者ID:salimvanak,項目名稱:myWMS,代碼行數:19,代碼來源:BasicEntityEditor.java

示例4: createHideTimeline

import javafx.stage.Popup; //導入依賴的package包/類
private Timeline createHideTimeline(final Popup popup, NotificationBar bar, final Pos p, Duration startDelay, Notifications notification) {
    KeyValue fadeOutBegin = new KeyValue(bar.opacityProperty(), 1.0);
    KeyValue fadeOutEnd = new KeyValue(bar.opacityProperty(), 0.0);

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

    Timeline timeline = new Timeline(kfBegin, kfEnd);
    timeline.setDelay(startDelay);
    timeline.setOnFinished(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent e) {
            hide(popup, p);
            notification.onHideAction.handle(e);
        }
    });

    return timeline;
}
 
開發者ID:yfiton,項目名稱:yfiton,代碼行數:20,代碼來源:Notifications.java

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: 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


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