Java Code Examples for javafx.stage.Stage#hide()

The following examples show how to use javafx.stage.Stage#hide() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainController.java    From MusicPlayer with MIT License 7 votes vote down vote up
private void createSearchPopup() {
	try {

		Stage stage = MusicPlayer.getStage();
		VBox view = new VBox();
           view.getStylesheets().add(Resources.CSS + "MainStyle.css");
           view.getStyleClass().add("searchPopup");
		Stage popup = new Stage();
		popup.setScene(new Scene(view));
		popup.initStyle(StageStyle.UNDECORATED);
		popup.initOwner(stage);
		searchHideAnimation.setOnFinished(x -> popup.hide());

		popup.show();
		popup.hide();
		searchPopup = popup;

	} catch (Exception ex) {

		ex.printStackTrace();
	}
}
 
Example 2
Source File: MementoHelper.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
/** Restore state of Stage from memento
 *  @param memento
 *  @param stage
 *  @return <code>true</code> if any tab item was restored
 */
public static boolean restoreStage(final MementoTree stage_memento, final Stage stage)
{
    // Closest to atomically setting size and location with minimal flicker: hide, update, show
    stage.hide();
    stage_memento.getNumber(X).ifPresent(num -> stage.setX(num.doubleValue()));
    stage_memento.getNumber(Y).ifPresent(num -> stage.setY(num.doubleValue()));
    stage_memento.getNumber(WIDTH).ifPresent(num -> stage.setWidth(num.doubleValue()));
    stage_memento.getNumber(HEIGHT).ifPresent(num -> stage.setHeight(num.doubleValue()));
    stage.show();
    stage_memento.getBoolean(FULLSCREEN).ifPresent(flag -> stage.setFullScreen(flag));
    stage_memento.getBoolean(MAXIMIZED).ifPresent(flag -> stage.setMaximized(flag));
    stage_memento.getBoolean(MINIMIZED).ifPresent(flag -> stage.setIconified(flag));

    // Initial pane of the new stage
    final DockPane pane = DockStage.getDockPanes(stage).get(0);
    // <pane> content or <split>
    final List<MementoTree> children = stage_memento.getChildren();
    if (children.size() != 1)
    {
        logger.log(Level.WARNING, "Expect single <pane> or <split>, got " + children);
        return false;
    }
    return restorePaneOrSplit(pane, children.get(0));
}
 
Example 3
Source File: PacketBuilderHomeController.java    From trex-stateless-gui with Apache License 2.0 5 votes vote down vote up
@FXML
public void saveProfileBtnClicked(ActionEvent event) {
    if (saveProfile()) {
        // close the dialog
        Node node = (Node) event.getSource();
        Stage stage = (Stage) node.getScene().getWindow();
        stage.hide();
    }
}
 
Example 4
Source File: AboutWindowViewController.java    From trex-stateless-gui with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @param event
 */
@FXML
public void closeAboutWindow(ActionEvent event) {
    Node node = (Node) event.getSource();
    Stage stage = (Stage) node.getScene().getWindow();
    stage.hide();
}
 
Example 5
Source File: ConnectDialogController.java    From trex-stateless-gui with Apache License 2.0 5 votes vote down vote up
private void connectionValidationFinished(final Stage stage, final String error) {
    if (error != null) {
        TrexAlertBuilder.build()
                .setType(Alert.AlertType.ERROR)
                .setContent(error)
                .getAlert()
                .show();
    } else {
        final String ip = connectionsCB.getEditor().getText();

        Connection con = new Connection(
            ip,
            rpcPortTextField.getText(),
            asyncPortTextField.getText(),
            scapyPortTextField.getText(),
            Integer.parseInt(timeoutField.getText()),
            nameTextField.getText(),
            fullControlRB.isSelected()
        );
        con.setLastUsed(true);
        connectionMap.put(ip, con);
        updateConnectionsList();
        ConnectionManager.getInstance().setConnected(true);

        stage.hide();
    }
    isConnectionInProgress.set(false);
}
 
Example 6
Source File: PreferencesController.java    From trex-stateless-gui with Apache License 2.0 5 votes vote down vote up
/**
 * Save preferences
 */
private void savePreferences(Stage current) {
    // update prefernces file
    Preferences pref = new Preferences(loadLocation.getText(), savedLocation.getText(), templatesLocation.getText(), wiresharkLocation.getText());
    
    PreferencesManager.getInstance().savePreferences(pref);

    current.hide();
}
 
Example 7
Source File: MainController.java    From MusicPlayer with MIT License 5 votes vote down vote up
private void createVolumePopup() {
	try {
		
		Stage stage = MusicPlayer.getStage();
    	FXMLLoader loader = new FXMLLoader(this.getClass().getResource(Resources.FXML + "VolumePopup.fxml"));
    	HBox view = loader.load();
    	volumePopupController = loader.getController();
    	Stage popup = new Stage();
    	popup.setScene(new Scene(view));
    	popup.initStyle(StageStyle.UNDECORATED);
    	popup.initOwner(stage);
    	popup.setX(stage.getWidth() - 270);
    	popup.setY(stage.getHeight() - 120);
    	popup.focusedProperty().addListener((x, wasFocused, isFocused) -> {
    		if (wasFocused && !isFocused) {
    			volumeHideAnimation.play();
    		}
    	});
    	volumeHideAnimation.setOnFinished(x -> popup.hide());
    	
    	popup.show();
    	popup.hide();
    	volumePopup = popup;
    	
	} catch (Exception ex) {
		
		ex.printStackTrace();
	}
}
 
Example 8
Source File: PacketBuilderHomeController.java    From trex-stateless-gui with Apache License 2.0 4 votes vote down vote up
@FXML
public void handleCloseDialog(final MouseEvent event) {
    Node node = (Node) event.getSource();
    Stage stage = (Stage) node.getScene().getWindow();
    stage.hide();
}
 
Example 9
Source File: ConnectDialogController.java    From trex-stateless-gui with Apache License 2.0 4 votes vote down vote up
@FXML
public void handleCloseDialog(final MouseEvent event) {
    Node node = (Node) event.getSource();
    Stage stage = (Stage) node.getScene().getWindow();
    stage.hide();
}
 
Example 10
Source File: ProfileStreamNameDialogController.java    From trex-stateless-gui with Apache License 2.0 4 votes vote down vote up
/**
 * Save name
 *
 * @param stage
 */
private void doCreating(Stage stage) {
    if (validInput()) {
        stage.hide();
    }
}
 
Example 11
Source File: AboutWindowViewController.java    From trex-stateless-gui with Apache License 2.0 2 votes vote down vote up
/**
 * Handle enter key pressed
 *
 * @param stage
 */
@Override
public void onEnterKeyPressed(Stage stage) {
    stage.hide();
}