use of javafx.geometry.Rectangle2D in project VocabHunter by VocabHunter.
the class EnvironmentManagerImpl method isVisible.
@Override
public boolean isVisible(final Placement placement) {
ObservableList<Screen> screens = Screen.getScreensForRectangle(rectangle(placement));
if (screens.size() == 1) {
Screen screen = screens.get(0);
Rectangle2D bounds = screen.getVisualBounds();
if (placement.isPositioned()) {
return bounds.contains(placement.getX(), placement.getY(), placement.getWidth(), placement.getHeight());
} else {
return bounds.getWidth() >= placement.getWidth() && bounds.getHeight() >= placement.getHeight();
}
} else {
return false;
}
}
use of javafx.geometry.Rectangle2D in project Retrospector by NonlinearFruit.
the class Retrospector method showSplash.
private void showSplash(final Stage initStage, Task<?> task, InitCompletionHandler initCompletionHandler) {
progressText.textProperty().bind(task.messageProperty());
loadProgress.progressProperty().bind(task.progressProperty());
task.stateProperty().addListener((observableValue, oldState, newState) -> {
if (newState == Worker.State.SUCCEEDED) {
loadProgress.progressProperty().unbind();
loadProgress.setProgress(1);
initStage.toFront();
FadeTransition fadeSplash = new FadeTransition(Duration.seconds(1.2), splashLayout);
fadeSplash.setFromValue(1.0);
fadeSplash.setToValue(0.0);
fadeSplash.setOnFinished(actionEvent -> initStage.hide());
fadeSplash.play();
initCompletionHandler.complete();
}
// todo add code to gracefully handle other task states.
});
Scene splashScene = new Scene(splashLayout, Color.TRANSPARENT);
final Rectangle2D bounds = Screen.getPrimary().getBounds();
initStage.setScene(splashScene);
initStage.setX(bounds.getMinX() + bounds.getWidth() / 2 - SPLASH_WIDTH / 2);
initStage.setY(bounds.getMinY() + bounds.getHeight() / 2 - SPLASH_HEIGHT / 2);
initStage.setAlwaysOnTop(true);
initStage.initStyle(StageStyle.TRANSPARENT);
initStage.show();
}
use of javafx.geometry.Rectangle2D in project proxyee-down by monkeyWie.
the class HttpDownApplication method start.
@Override
public void start(Stage stage) throws Exception {
initHandle();
this.stage = stage;
Platform.setImplicitExit(false);
isSupportBrowser = isSupportBrowser();
SwingUtilities.invokeLater(this::addTray);
// webview加载
if (ContentManager.CONFIG.get().getUiModel() == 1 && isSupportBrowser) {
initBrowser();
}
stage.setTitle("proxyee-down-" + version);
Rectangle2D bounds = Screen.getPrimary().getVisualBounds();
ConfigInfo cf = ContentManager.CONFIG.get();
stage.setX(cf.getGuiX() >= 0 ? cf.getGuiX() : bounds.getMinX());
stage.setY(cf.getGuiY() >= 0 ? cf.getGuiY() : bounds.getMinY());
stage.setWidth(cf.getGuiWidth() >= 0 ? cf.getGuiWidth() : bounds.getWidth());
stage.setHeight(cf.getGuiHeight() >= 0 ? cf.getGuiHeight() : bounds.getHeight());
stage.getIcons().add(new Image(Thread.currentThread().getContextClassLoader().getResourceAsStream("favicon.png")));
// 关闭窗口监听
stage.setOnCloseRequest(event -> {
event.consume();
close();
});
}
use of javafx.geometry.Rectangle2D in project jphp by jphp-compiler.
the class UXForm method maximize.
@Signature
public void maximize() {
Screen screen = Screen.getPrimary();
Rectangle2D bounds = screen.getVisualBounds();
getWrappedObject().setX(bounds.getMinX());
getWrappedObject().setY(bounds.getMinY());
getWrappedObject().setWidth(bounds.getWidth());
getWrappedObject().setHeight(bounds.getHeight());
}
use of javafx.geometry.Rectangle2D in project Gargoyle by callakrsos.
the class FxUtil method getCenter.
public Point2D getCenter(Stage window) {
Rectangle2D bounds = Screen.getPrimary().getVisualBounds();
double centerX = bounds.getMinX() + (bounds.getWidth() - window.getWidth()) * CENTER_ON_SCREEN_X_FRACTION;
double centerY = bounds.getMinY() + (bounds.getHeight() - window.getHeight()) * CENTER_ON_SCREEN_Y_FRACTION;
return new Point2D(centerX, centerY);
}
Aggregations