Java Code Examples for javafx.stage.StageStyle#TRANSPARENT

The following examples show how to use javafx.stage.StageStyle#TRANSPARENT . 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: Undecorator.java    From DevToolBox with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Prepare Stage for dock feedback display
 */
void buildDockFeedbackStage() {
    dockFeedbackPopup = new Stage(StageStyle.TRANSPARENT);
    dockFeedback = new Rectangle(0, 0, 100, 100);
    dockFeedback.setArcHeight(10);
    dockFeedback.setArcWidth(10);
    dockFeedback.setFill(Color.TRANSPARENT);
    dockFeedback.setStroke(Color.BLACK);
    dockFeedback.setStrokeWidth(2);
    dockFeedback.setCache(true);
    dockFeedback.setCacheHint(CacheHint.SPEED);
    dockFeedback.setEffect(new DropShadow(BlurType.TWO_PASS_BOX, Color.BLACK, 10, 0.2, 3, 3));
    dockFeedback.setMouseTransparent(true);
    BorderPane borderpane = new BorderPane();
    borderpane.setStyle("-fx-background-color:transparent"); //J8
    borderpane.setCenter(dockFeedback);
    Scene scene = new Scene(borderpane);
    scene.setFill(Color.TRANSPARENT);
    dockFeedbackPopup.setScene(scene);
    dockFeedbackPopup.sizeToScene();
}
 
Example 2
Source File: DigitFactory.java    From metastone with GNU General Public License v2.0 6 votes vote down vote up
public static void saveAllDigits() {
	Stage stage = new Stage(StageStyle.TRANSPARENT);
	DigitTemplate root = new DigitTemplate();
	Scene scene = new Scene(root);
	stage.setScene(scene);
	stage.show();

	SnapshotParameters snapshotParams = new SnapshotParameters();
	snapshotParams.setFill(Color.TRANSPARENT);
	root.digit.setText("-");
	for (int i = 0; i <= 10; i++) {
		WritableImage image = root.digit.snapshot(snapshotParams, null);

		File file = new File("src/" + IconFactory.RESOURCE_PATH + "/img/common/digits/" + root.digit.getText() + ".png");

		try {
			ImageIO.write(SwingFXUtils.fromFXImage(image, null), "png", file);
		} catch (IOException e) {
			e.printStackTrace();
		}
		root.digit.setText("" + i);
	}

	stage.close();
}
 
Example 3
Source File: ScreenShotFrame.java    From oim-fx with MIT License 5 votes vote down vote up
public ScreenShotFrame() {
	// super(StageStyle.UNDECORATED);
	super(StageStyle.TRANSPARENT);
	init();
	initMenu();
	initEvent();
}
 
Example 4
Source File: UndecoratorScene.java    From DevToolBox with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * UndecoratorScene constructor
 *
 * @param stage The main stage
 * @param stageStyle could be StageStyle.UTILITY or StageStyle.TRANSPARENT
 * @param root your UI to be displayed in the Stage
 * @param stageDecorationFxml Your own Stage decoration or null to use the
 * built-in one
 */
public UndecoratorScene(Stage stage, StageStyle stageStyle, Region root, String stageDecorationFxml) {
    super(root);
    myRoot = root;
    /*
     * Fxml
     */
    if (stageDecorationFxml == null) {
        if (stageStyle == StageStyle.UTILITY) {
            stageDecorationFxml = STAGEDECORATION_UTILITY;
        } else {
            stageDecorationFxml = STAGEDECORATION;
        }
    }
    undecorator = new Undecorator(stage, root, stageDecorationFxml, stageStyle);
    super.setRoot(undecorator);

    // Customize it by CSS if needed:
    if (stageStyle == StageStyle.UTILITY) {
        undecorator.getStylesheets().add(STYLESHEET_UTILITY);
    } else {
        undecorator.getStylesheets().add(STYLESHEET);
    }

    // Transparent scene and stage
    if (stage.getStyle() != StageStyle.TRANSPARENT) {
        stage.initStyle(StageStyle.TRANSPARENT);
    }
    super.setFill(Color.TRANSPARENT);

    // Default Accelerators
    undecorator.installAccelerators(this);

    // Forward pref and max size to main stage
    stage.setMinWidth(undecorator.getMinWidth());
    stage.setMinHeight(undecorator.getMinHeight());
    stage.setWidth(undecorator.getPrefWidth());
    stage.setHeight(undecorator.getPrefHeight());
}
 
Example 5
Source File: DragAndDropHandler.java    From FxDock with Apache License 2.0 5 votes vote down vote up
protected static Stage createDragWindow(FxDockPane client)
{
	Window owner = FX.getParentWindow(client);
	Image im = createDragImage(client);
	Pane p = new Pane(new ImageView(im));
	Stage s = new Stage(StageStyle.TRANSPARENT);
	s.initOwner(owner);
	s.setScene(new Scene(p, im.getWidth(), im.getHeight()));
	s.setOpacity(DRAG_WINDOW_OPACITY);
	return s;
}
 
Example 6
Source File: DockNode.java    From DockFX with GNU Lesser General Public License v3.0 4 votes vote down vote up
public final boolean isDecorated() {
  return stageStyle != StageStyle.TRANSPARENT && stageStyle != StageStyle.UNDECORATED;
}
 
Example 7
Source File: UndecoratorScene.java    From DevToolBox with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Basic constructor with built-in behavior
 *
 * @param stage The main stage
 * @param root your UI to be displayed in the Stage
 */
public UndecoratorScene(Stage stage, Region root) {
    this(stage, StageStyle.TRANSPARENT, root, STAGEDECORATION);
}