本文整理匯總了Java中javafx.stage.StageStyle類的典型用法代碼示例。如果您正苦於以下問題:Java StageStyle類的具體用法?Java StageStyle怎麽用?Java StageStyle使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
StageStyle類屬於javafx.stage包,在下文中一共展示了StageStyle類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: AboutView
import javafx.stage.StageStyle; //導入依賴的package包/類
/**
* Creates an instance of a {@link AboutView}.
*
* @throws IOException if unable to load the controller
*/
@Inject
public AboutView(final FXMLLoader fxmlLoader) throws UIInitialisationException, IOException {
stage = new Stage();
stage.initStyle(StageStyle.UNDECORATED);
stage.setResizable(false);
final URL resource = getClass().getResource(ABOUT_VIEW);
fxmlLoader.setLocation(resource);
final Scene rootScene = new Scene(fxmlLoader.load());
rootScene.addEventHandler(KeyEvent.KEY_PRESSED, event -> {
if (event.getCode() == KeyCode.ESCAPE) {
stage.hide();
}
});
stage.setScene(rootScene);
stage.focusedProperty().addListener((observable, oldValue, newValue) -> {
if (!newValue) {
stage.hide();
}
});
}
示例2: createStage
import javafx.stage.StageStyle; //導入依賴的package包/類
/**
* Creates stage by calling createScene and with almost every properties of object.
*
* @see GenericView#createScene()
* @see javafx.stage.Stage
* @return
* @throws IOException
*/
public Stage createStage() throws IOException {
Stage stage = new Stage();
if (this.getTitle() != null) stage.setTitle(this.getTitle());
stage.setScene(this.createScene());
stage.setResizable(this.isResizable());
stage.setMaximized(this.isMaximized());
stage.setFullScreen(this.isFullscreen());
stage.setFullScreenExitKeyCombination(KeyCombination.NO_MATCH);
if (!this.isDecorated()) stage.initStyle(StageStyle.UNDECORATED);
if (this.isModal()) stage.initModality(Modality.APPLICATION_MODAL);
if (this.getIcon() != null)
stage.getIcons().add(this.getIcon());
if (this.getIcon() == null && GenericView.getGlobalIcon() != null)
stage.getIcons().add(GenericView.getGlobalIcon());
return stage;
}
示例3: Exe
import javafx.stage.StageStyle; //導入依賴的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();
}
示例4: loadTopsoilWindow
import javafx.stage.StageStyle; //導入依賴的package包/類
public void loadTopsoilWindow(double x, double y) {
Pane topsoilPlotUI = topsoilPlot.initializePlotPane();
Scene topsoilPlotScene = new Scene(topsoilPlotUI, 600, 600);
topsoilPlotWindow = new Stage(StageStyle.DECORATED);
// center on Squid
topsoilPlotWindow.setX(x);
topsoilPlotWindow.setY(y);
topsoilPlotWindow.setResizable(true);
topsoilPlotWindow.setScene(topsoilPlotScene);
topsoilPlotWindow.setTitle("Topsoil Plot");
topsoilPlotWindow.requestFocus();
topsoilPlotWindow.initOwner(null);
topsoilPlotWindow.initModality(Modality.NONE);
topsoilPlotWindow.show();
}
示例5: loadImageArchiveEditor
import javafx.stage.StageStyle; //導入依賴的package包/類
@FXML
private void loadImageArchiveEditor() {
try {
FXMLLoader loader = new FXMLLoader(App.class.getResource("/ImageArchiveUI.fxml"));
Parent root = loader.load();
ImageArchiveController controller = loader.getController();
Stage stage = new Stage();
controller.setStage(stage);
stage.setTitle("Image Archive Editor");
Scene scene = new Scene(root);
scene.getStylesheets().add(App.class.getResource("/style.css").toExternalForm());
stage.getIcons().add(new Image(getClass().getResourceAsStream("/icons/app_icon_128.png")));
stage.setScene(scene);
stage.initStyle(StageStyle.TRANSPARENT);
stage.setResizable(false);
stage.centerOnScreen();
stage.setTitle("Archive Editor");
stage.show();
} catch (IOException e) {
e.printStackTrace();
}
}
示例6: start
import javafx.stage.StageStyle; //導入依賴的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();
}
示例7: start
import javafx.stage.StageStyle; //導入依賴的package包/類
@Override
public void start(final Stage stage) throws Exception {
GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
int width = gd.getDisplayMode().getWidth();
int height = gd.getDisplayMode().getHeight();
Scene scene = new Scene(FXMLLoader.load(UDEDesktop.class.getResource("resources/UDEDesktopWindow.fxml")), width, height);
scene.setFill(null);
scene.getStylesheets().add("resources/stylesheet.css");
stage.setScene(scene);
// stage.initStyle(StageStyle.UNDECORATED);
stage.initStyle(StageStyle.TRANSPARENT);
stage.setTitle("UDEDesktop");
stage.setMinWidth(300);
stage.setMinHeight(300);
stage.show();
stage.toBack();
}
示例8: start
import javafx.stage.StageStyle; //導入依賴的package包/類
@Override
public void start(Stage stage) {
App.stage = stage;
try {
Parent root = FXMLLoader.load(App.class.getResource("/ui/Main.fxml"));
Scene scene = new Scene(root);
scene.getStylesheets().add(getClass().getResource("/style.css").toExternalForm());
stage.setTitle("OSRS Data To 317 Converter");
stage.centerOnScreen();
stage.setResizable(false);
stage.sizeToScene();
stage.initStyle(StageStyle.UNDECORATED);
stage.setScene(scene);
stage.getIcons().add(new Image(App.class.getResourceAsStream("/icons/icon.png")));
stage.show();
} catch(Exception e) {
e.printStackTrace();
}
}
示例9: start
import javafx.stage.StageStyle; //導入依賴的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();
}
示例10: btnAboutAction
import javafx.stage.StageStyle; //導入依賴的package包/類
@FXML
private void btnAboutAction()
{
try
{
FXMLLoader loader = new FXMLLoader(MainDisplay.class.getResource("/fxml/AboutDialog.fxml"));
Parent root = loader.load();
Scene scene = new Scene(root);
Stage stage = new Stage();
stage.initModality(Modality.APPLICATION_MODAL);
stage.initStyle(StageStyle.UNDECORATED);
stage.setScene(scene);
stage.show();
}
catch(IOException e)
{
e.printStackTrace();
}
}
示例11: print
import javafx.stage.StageStyle; //導入依賴的package包/類
public void print()
{
Printer printer = Printer.getDefaultPrinter();
Stage stage = new Stage(StageStyle.DECORATED);
PrinterJob job = PrinterJob.createPrinterJob(printer);
if (job != null) {
boolean showDialog = job.showPageSetupDialog(stage);
if (showDialog) {
myPrint.setScaleX(0.46);
myPrint.setScaleY(0.46);
myPrint.setTranslateX(-252);
myPrint.setTranslateY(-110);
boolean success = job.printPage(myPrint);
if (success) {
job.endJob();
}
myPrint.setTranslateX(0);
myPrint.setTranslateY(0);
myPrint.setScaleX(1.0);
myPrint.setScaleY(1.0);
}
}
}
示例12: alwaysInTop
import javafx.stage.StageStyle; //導入依賴的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());
}
示例13: showInDialog
import javafx.stage.StageStyle; //導入依賴的package包/類
private void showInDialog(javafx.event.ActionEvent event) {
//("SpecificationTableView.SpecificationTableView");
Stage s = new Stage(StageStyle.DECORATED);
s.setTitle(getText());
s.initModality(Modality.APPLICATION_MODAL);
s.setMinHeight(640);
s.setMinHeight(480);
s.setFullScreen(true);
//s.setMaximized(true);
//TableView<HybridRow> newView = new TableView<>(tableView.getItems());
setContent(new Label("opened externally"));
BorderPane root = new BorderPane(tableView);
ButtonBar bb = new ButtonBar();
root.setTop(bb);
s.setScene(new Scene(root));
Button yesButton = new Button("Close");
ButtonBar.setButtonData(yesButton, ButtonBar.ButtonData.CANCEL_CLOSE);
bb.getButtons().addAll(yesButton);
yesButton.setOnAction(e -> s.hide());
s.showAndWait();
setContent(tableView);
}
示例14: buildWindow
import javafx.stage.StageStyle; //導入依賴的package包/類
private static Stage buildWindow (String title)
{
tempStage = new Stage();
tempStage.initStyle(StageStyle.UTILITY); // Einfaches Fenster
// ohne 'minimiere'
// und 'maximiere'
// Buttons
tempStage.setResizable(false); // Verbiete �nderung
// der Gr�sse
tempStage.initModality(Modality.APPLICATION_MODAL); // Blockiere alle
// anderen
// Fenster
tempStage.setTitle(title); // Setze Titel
return tempStage;
}
示例15: createModal
import javafx.stage.StageStyle; //導入依賴的package包/類
private void createModal(String fxmlRes) throws IOException{
Stage modalLogin = new Stage();
Parent root = FXMLLoader.load(getClass().getResource("/fxml/"+fxmlRes));
Scene scene = new Scene(root);
scene.getStylesheets().add("/styles/Styles.css");
modalLogin.setScene(scene);
modalLogin.initStyle(StageStyle.UNDECORATED);
modalLogin.initOwner(login_btn.getScene().getWindow());
modalLogin.initModality(Modality.APPLICATION_MODAL);
modalLogin.showAndWait();
if(toggle) {
this.toggleControls();
HomeController.refreshMySong();
}
toggle = false;
}