本文整理汇总了Java中javafx.stage.Stage.setAlwaysOnTop方法的典型用法代码示例。如果您正苦于以下问题:Java Stage.setAlwaysOnTop方法的具体用法?Java Stage.setAlwaysOnTop怎么用?Java Stage.setAlwaysOnTop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.stage.Stage
的用法示例。
在下文中一共展示了Stage.setAlwaysOnTop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Exe
import javafx.stage.Stage; //导入方法依赖的package包/类
void Exe(int i) {
if(i==1) {
warnmesse="プレイ開始から5分経過しました\n混雑している場合は次の人に\n交代してください";
fontsize=25;
}else if(i==2) {
warnmesse="プレイ開始から10分経過しました\n混雑している場合は次の人に\n交代してください";
fontsize=25;
}else if(i==-1) {
warnmesse="user timer is reset";
fontsize=35;
}
final Stage primaryStage = new Stage(StageStyle.TRANSPARENT);
primaryStage.initModality(Modality.NONE);
final StackPane root = new StackPane();
final Scene scene = new Scene(root, 350, 140);
scene.setFill(null);
final Label label = new Label(warnmesse);
label.setFont(new Font("Arial", fontsize));
BorderPane borderPane = new BorderPane();
borderPane.setCenter(label);
borderPane.setStyle("-fx-background-radius: 10;-fx-background-color: rgba(0,0,0,0.3);");
root.getChildren().add(borderPane);
final Rectangle2D d = Screen.getPrimary().getVisualBounds();
primaryStage.setScene(scene);
primaryStage.setAlwaysOnTop(true);
primaryStage.setX(d.getWidth()-350);
primaryStage.setY(d.getHeight()-300);
primaryStage.show();
final Timeline timer = new Timeline(new KeyFrame(Duration.seconds(CLOSE_SECONDS), (ActionEvent event) -> primaryStage.close()));
timer.setCycleCount(Timeline.INDEFINITE);
timer.play();
}
示例2: aendereReihenfolge
import javafx.stage.Stage; //导入方法依赖的package包/类
private void aendereReihenfolge(){
Stage stage = new Stage();
Label l = new Label("Reihenfolge festlegen:");
l.setStyle("-fx-text-fill: white");
l.setFont(Font.font(settingsFontSize));
l.setTranslateY(25);
l.setTranslateX(25);
TextField tf = new TextField(String.valueOf(orderId+1));
tf.setFont(Font.font(settingsFontSize-3));
tf.setTranslateX(25);
tf.setTranslateY(60);
Button b = new Button("Speichern");
b.setFont(Font.font(settingsFontSize));
b.setTranslateX(25);
b.setTranslateY(120);
b.setOnAction(e -> {
orderId = Integer.parseInt(tf.getText())-1;
stage.close();
Plugin_Gleisbelegung.sortiereGleiseListener();
});
Pane p = new Pane(l,tf,b);
p.setStyle("-fx-background-color: #303030");
p.setMinSize(500,200);
p.setMaxSize(500, 200);
Scene scene = new Scene(p, 300,200);
stage.setScene(scene);
stage.show();
stage.setAlwaysOnTop(true);
}
示例3: start
import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(final Stage primaryStage) throws Exception
{
this.preloaderStage = primaryStage;
final ImageView splash = new ImageView(new Image(Constant.IMG_DIR + "banner.png"));
this.loadProgressPhase = new JFXProgressBar();
this.loadProgressPhase.setPrefWidth(Constant.SPLASH_WIDTH);
this.splashLayout = new VBox();
this.splashLayout.getChildren().addAll(splash, this.loadProgressPhase);
this.splashLayout.setStyle("-fx-padding: 5; " + "-fx-background-color: gainsboro; " + "-fx-border-width:2; "
+ "-fx-border-color: " + "linear-gradient(" + "to bottom, " + "MediumSeaGreen, "
+ "derive(MediumSeaGreen, 50%)" + ");");
this.splashLayout.setEffect(new DropShadow());
final Scene splashScene = new Scene(this.splashLayout, Color.TRANSPARENT);
final Rectangle2D bounds = Screen.getPrimary().getBounds();
primaryStage.setScene(splashScene);
primaryStage.setX(bounds.getMinX() + bounds.getWidth() / 2 - Constant.SPLASH_WIDTH / 2);
primaryStage.setY(bounds.getMinY() + bounds.getHeight() / 2 - Constant.SPLASH_HEIGHT / 2);
primaryStage.getIcons().add(new Image(Constant.IMG_DIR + "icon.png"));
primaryStage.setTitle(Constant.APP_NAME);
primaryStage.initStyle(StageStyle.UNDECORATED);
primaryStage.setAlwaysOnTop(true);
primaryStage.show();
}
示例4: start
import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
URL location = getClass().getResource("MainFXMLDocument.fxml");
Parent root = FXMLLoader.load(location);
root.setOnMouseDragged(e -> this.dragStage(e, stage));
root.setOnMouseMoved(e -> this.calculateGap(e, stage));
Scene scene = new Scene(root, Color.TRANSPARENT);
scene.getStylesheets().add("/com/shekkar/xpanderfx/mainStyler.css");
stage.setScene(scene);
stage.setAlwaysOnTop(true);
stage.initStyle(StageStyle.TRANSPARENT);
stage.show();
}
示例5: showNoticeDialog
import javafx.stage.Stage; //导入方法依赖的package包/类
@FXML
public void showNoticeDialog() {
try {
FXMLLoader loader = new FXMLLoader(Main.class.getResource("views/Notice.fxml"));
StackPane page = (StackPane) loader.load();
Stage dialog = new Stage();
Scene scene = new Scene(page);
dialog.getIcons().add(new Image("file:wdm.png"));
dialog.setTitle("공지사항");
dialog.initModality(Modality.WINDOW_MODAL);
dialog.setResizable(false);
dialog.setScene(scene);
dialog.setAlwaysOnTop(true);
dialog.show();
} catch (Exception e) {
e.printStackTrace();
}
}
示例6: alwaysInTop
import javafx.stage.Stage; //导入方法依赖的package包/类
public static void alwaysInTop(Alert alert) {
try{
DialogPane root = alert.getDialogPane();
Stage dialogStage = new Stage(StageStyle.UTILITY);
for (ButtonType buttonType : root.getButtonTypes()) {
ButtonBase button = (ButtonBase) root.lookupButton(buttonType);
button.setOnAction(evt -> {
root.setUserData(buttonType);
dialogStage.close();
});
}
root.getScene().setRoot(new Group());
Scene scene = new Scene(root);
dialogStage.setScene(scene);
dialogStage.initModality(Modality.APPLICATION_MODAL);
dialogStage.setAlwaysOnTop(true);
dialogStage.setResizable(false);
dialogStage.showAndWait();
}catch(Exception e){
}
// Optional<ButtonType> result = Optional.ofNullable((ButtonType) root.getUserData());
}
示例7: openHelpText
import javafx.stage.Stage; //导入方法依赖的package包/类
/**
* @param url the url of the website to be shown
*/
public static void openHelpText(String title, String url) {
WebView wv = new WebView();
wv.getEngine().setJavaScriptEnabled(false);
wv.getEngine().load(url);
Scene pane = new Scene(wv);
Stage state = new Stage();
state.setScene(pane);
// pane.getButtonTypes().add(ButtonType.CLOSE);
state.setAlwaysOnTop(true);
state.setTitle(title);
state.setResizable(true);
state.setOpacity(0.8);
state.setMinHeight(250);
state.setMinWidth(250);
state.show();
}
示例8: start
import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(Stage stage) {
Scene scene = new Scene(new Group(rectangle = new Rectangle(100, 100)), 300, 300);
stage.setScene(scene);
stage.setAlwaysOnTop(true);
stage.show();
config = DragSupport.bind(rectangle);
}
示例9: start
import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
Scene scene = new Scene(new Group(rectangle = new Rectangle(100, 100)), 300, 300);
rectangle.setLayoutX(100);
rectangle.setLayoutY(100);
stage.setScene(scene);
stage.setAlwaysOnTop(true);
stage.show();
config = ResizeSupport.bind(rectangle);
}
示例10: start
import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(Stage stage) {
this.stage = stage;
Scene scene = new Scene(new Group(new Rectangle(100, 100)), 300, 300);
stage.setScene(scene);
stage.setAlwaysOnTop(true);
stage.setX(0);
stage.setY(0);
stage.show();
config = DragSupport.bind(stage);
}
示例11: createAndShowLoading
import javafx.stage.Stage; //导入方法依赖的package包/类
/**
* This method will create loading scene in new stage, show it to the user, and then return the object of loading
* @return - created loading object
*/
public static WindowLoadingController createAndShowLoading() {
Stage stage = new Stage();
stage.setAlwaysOnTop(true);
stage.setResizable(false);
stage.setTitle("Loading");
WindowLoadingController controller = new WindowLoadingController();
stage.setScene(NodeType.WINDOW_LOADING.getScene(controller));
stage.show();
return controller;
}
示例12: initGraphics
import javafx.stage.Stage; //导入方法依赖的package包/类
protected void initGraphics(Stage stage) {
scene = new Scene(new Region());
scene.setFill(null);
stage.setMaxWidth(1);
stage.setMaxHeight(1);
stage.setWidth(1);
stage.setHeight(1);
stage.getIcons().add(new javafx.scene.image.Image("resources/Logo.png"));
stage.setResizable(false);
stage.setAlwaysOnTop(true);
}
示例13: start
import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
Platform.setImplicitExit(false);
Injector.setConfigurationSource(config::getInjectionValue);
Injector.setLogger(s -> LOG.info(s));
Injector.setModelOrService(Logger.class, LOG);
Injector.setModelOrService(HueSenseConfig.class, config);
Injector.setModelOrService(DBManager.class, dbMan);
Injector.setModelOrService(DataStore.class, store);
Injector.setModelOrService(HueComm.class, hue);
Injector.setModelOrService(LanComm.class, lan);
Injector.setModelOrService(MailService.class, mailServ);
ConnectingView connView = new ConnectingView();
Scene scene = new Scene(connView.getView());
scene.setFill(Color.WHITE);
stage.setTitle("HueSense");
final String uri = Thread.currentThread().getContextClassLoader().getResource("global.css").toExternalForm();
scene.getStylesheets().add(uri);
stage.initStyle(StageStyle.TRANSPARENT);
stage.setScene(scene);
stage.setAlwaysOnTop(true);
stage.setResizable(false);
stage.centerOnScreen();
UIUtils.setIcon(stage);
stage.show();
hue.startConnecting();
}
示例14: display
import javafx.stage.Stage; //导入方法依赖的package包/类
public static void display(String title, String message)
{
Stage window= new Stage();
window.initModality(Modality.APPLICATION_MODAL);
window.setAlwaysOnTop(true);
window.getIcons().add(new Image("/pic/slogo.png"));
window.setTitle(title);
Label label= new Label();
label.setText(message);
label.setStyle("-fx-font-size:14px;");
ImageView imageView = new ImageView(ICON);
imageView.setFitWidth(40);
imageView.setFitHeight(40);
Label labelimage = new Label("",imageView);
// two buttons
Button okbtn= new Button("Ok");
okbtn.setOnAction(e -> {
answer= false;
window.close();
});
okbtn.setId("blue");
HBox hbox= new HBox(10);
hbox.setAlignment(Pos.CENTER_LEFT);
hbox.setPadding(new Insets(10,5,10,5));
hbox.getChildren().addAll(labelimage,label);
VBox layout= new VBox(15);
layout.setAlignment(Pos.CENTER_RIGHT);
layout.setPadding(new Insets(10,5,10,5));
layout.getChildren().addAll(hbox,okbtn);
layout.setStyle("-fx-background-color: linear-gradient(#E4EAA2, #9CD672);");
Scene scene= new Scene(layout);
window.setScene(scene);
scene.getStylesheets().add(SuccessMessage.class.getResource("confirm.css").toExternalForm());
window.setResizable(false);
window.showAndWait();
}
示例15: setupLogController
import javafx.stage.Stage; //导入方法依赖的package包/类
public static void setupLogController() {
try {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
URL fxmlUrl = classLoader.getResource("gui/log.fxml");
if (fxmlUrl == null) {
OneClientLogging.logger.error("An error has occurred loading instance_creation.fxml!");
return;
}
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(fxmlUrl);
fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
Parent root = fxmlLoader.load(fxmlUrl.openStream());
stage = new Stage();
stage.setTitle("One Client - Log");
stage.getIcons().add(new Image("images/icon.png"));
stage.setResizable(true);
stage.setAlwaysOnTop(false);
stage.initOwner(Main.stage);
stage.initModality(Modality.NONE);
Scene scene = new Scene(root, 600, 300);
scene.getStylesheets().add("gui/css/theme.css");
stage.setScene(scene);
logController = fxmlLoader.getController();
logController.setStage(stage);
TextAreaAppender.setTextArea(logController.logArea);
} catch (Exception e) {
OneClientLogging.error(e);
}
}