本文整理汇总了Java中javafx.stage.Stage.setMaximized方法的典型用法代码示例。如果您正苦于以下问题:Java Stage.setMaximized方法的具体用法?Java Stage.setMaximized怎么用?Java Stage.setMaximized使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.stage.Stage
的用法示例。
在下文中一共展示了Stage.setMaximized方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createStage
import javafx.stage.Stage; //导入方法依赖的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;
}
示例2: start
import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("menuSample.fxml"));
primaryStage.setTitle("Hello World");
Screen screen = Screen.getPrimary();
Rectangle2D bounds = screen.getVisualBounds();
primaryStage.setX(bounds.getMinX());
primaryStage.setY(bounds.getMinY());
primaryStage.setWidth(bounds.getWidth());
primaryStage.setHeight(bounds.getHeight());
primaryStage.setMaximized(true);
Scene menuScene = new Scene(root, 1080, 720);
//primaryStage.setFullScreen(true);
primaryStage.setScene(menuScene);
//primaryStage.setFullScreen(true);
primaryStage.show();
}
示例3: start
import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
logger.info(getRuntimeDetails());
Point mousePosition = MouseInfo.getPointerInfo().getLocation();
stage.setX(mousePosition.getX());
stage.setY(mousePosition.getY());
try {
dataStorage = new DataStorage();
} catch (IOException ex) {
logger.error("Could not initialize working directory", ex);
ExceptionDialog exceptionDialog = new ExceptionDialog(ex);
exceptionDialog.setTitle("Error");
exceptionDialog.setHeaderText("Could not initialize working directory");
exceptionDialog.show();
return;
}
new MainWindow(stage);
stage.setMaximized(true);
}
示例4: showInDialog
import javafx.stage.Stage; //导入方法依赖的package包/类
private void showInDialog(javafx.event.ActionEvent event) {
Stage s = new Stage(StageStyle.DECORATED);
s.setTitle(tp.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());
BorderPane root = new BorderPane(content);
tp.setContent(new Label("opened externally"));
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();
tp.setContent(content);
}
示例5: maximize
import javafx.stage.Stage; //导入方法依赖的package包/类
@FXML
void maximize(ActionEvent event)
{
Stage stage = (Stage) root.getScene().getWindow();
stage.setMaximized(!stage.isMaximized());
if (stage.isMaximized())
{
menubar.setPrefWidth(stage.getWidth());
windowsButton.setLayoutX(stage.getWidth() - windowsButton.getWidth());
keyList.setPrefHeight(keyList.getPrefHeight() + 190);
}
if (!stage.isMaximized())
{
windowsButton.setLayoutX(stage.getWidth() - windowsButton.getWidth());
menubar.setPrefWidth(stage.getWidth());
keyList.setPrefHeight(keyList.getPrefHeight() - 190);
}
}
示例6: start
import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(Stage rootStage) throws Exception {
rootStage.setMaximized(true);
main = this;
FXMLLoader loader = new FXMLLoader(getClass().getResource("/resources/layouts/main.fxml"));
Parent root = loader.load();
Scene rootScene = new Scene(root);
rootStage.setTitle("Parallator");
rootController = loader.getController();
rootStage.setScene(rootScene);
initMenu(rootStage);
rootStage.show();
rootStage.setOnCloseRequest(event -> {
if (rootController.getFile() == null || !rootController.isEdited()) return;
Alert alert = new Alert(Alert.AlertType.WARNING);
alert.setHeaderText("Сохранить перед выходом?");
alert.getButtonTypes().setAll(ButtonType.YES, ButtonType.NO, ButtonType.CANCEL);
Optional<ButtonType> result = alert.showAndWait();
if (result.isPresent() && result.get() == ButtonType.YES) {
rootController.save();
}
if (result.isPresent() && result.get() == ButtonType.CANCEL) {
event.consume();
}
});
rootScene.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
switch (event.getCode()) {
case DOWN:
rootController.down();
break;
case UP:
rootController.up();
break;
}
});
if (MainConfig.getMainConfig().path() != null) rootController.open(new File(MainConfig.getMainConfig().path()));
}
示例7: start
import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(Stage mainStage) throws IOException, PrinterException {
ScreenManager screenManager = ScreenManager.getInstance();
screenManager.initialize(mainStage);
Parent root = FXMLLoader.load(getClass().getResource("/fxml/HomeScreen.fxml"));
Scene mainScene = new Scene(root);
mainStage.setScene(mainScene);
Image appLogo = new Image("images/Logo.png");
mainStage.getIcons().add(appLogo);
mainStage.setTitle("Git-Rektsort Booking Software");
mainStage.setMaximized(true);
mainStage.show();
GuestService guestService = new GuestService();
guestService.getCurrentlyCheckedInGuests();
DatabaseTestDataLoader.initializeTestData();
}
示例8: start
import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(final Stage primaryStage) throws IOException, UIInitialisationException, SQLException {
context.init();
this.primaryStage = primaryStage;
setInstance(this);
final URL resource = getClass().getResource(APPLICATION_VIEW);
fxmlLoader.setLocation(resource);
final Parent parent = fxmlLoader.load();
primaryStage.setTitle(TITLE);
primaryStage.setMaximized(true);
primaryStage.setOnCloseRequest(e -> {
bookmarkStore.writeBookmarksToFile();
Platform.exit();
});
final Scene rootScene = new Scene(parent);
primaryStage.setScene(rootScene);
final Image hygeneIcon = new Image(String.valueOf(getClass().getResource(APPLICATION_ICON)));
primaryStage.getIcons().add(hygeneIcon);
primaryStage.show();
parseArguments();
LOGGER.info("Launching Hygene GUI");
}
示例9: showPlanchesterGUI
import javafx.stage.Stage; //导入方法依赖的package包/类
private static void showPlanchesterGUI() {
try {
primaryStage = new Stage();
primaryStage.setTitle("Planchester");
//primaryStage.setResizable(false);
primaryStage.setMaximized(true);
primaryStage.setOnCloseRequest(t -> {
closePlanchester();
});
scene = new Scene(FXMLLoader.load(PlanchesterGUI.class.getResource("PlanchesterFrame.fxml")));
URL url = PlanchesterGUI.class.getResource("CSS/stylesheet.css");
if (url == null) {
throw new UnexpectedException("CSS Resource not found. Aborting.");
}
String css = url.toExternalForm();
scene.getStylesheets().add(css);
primaryStage.setScene(scene);
primaryStage.getIcons().add(new Image("file:src/Presentation/Images/logoplanchester.png"));
primaryStage.show();
} catch (IOException exception) {
exception.printStackTrace();
}
}
示例10: backPressed
import javafx.stage.Stage; //导入方法依赖的package包/类
public void backPressed(MouseEvent mouseEvent) throws IOException {
Button button = (Button) mouseEvent.getSource();
if ((button).getText().equals("BACK")) {
Stage current = (Stage) button.getScene().getWindow();
Parent root = FXMLLoader.load(getClass().getResource("menuSample.fxml"));
current.setScene(new Scene(root, screenSize.getWidth(), screenSize.getHeight()));
current.setMaximized(true);
current.show();
}
}
示例11: buttonPressed
import javafx.stage.Stage; //导入方法依赖的package包/类
@FXML
public void buttonPressed(MouseEvent actionEvent) throws IOException {
Button button = (Button)actionEvent.getSource();
if ((button).getText().equals("BACK"))
{
Stage current = (Stage)button.getScene().getWindow();
Parent root = FXMLLoader.load(getClass().getResource("menuSample.fxml"));
current.setMaximized(true);
current.setScene(new Scene(root, screenSize.getWidth(), screenSize.getHeight()));
//current.setFullScreen(true);
current.show();
}
}
示例12: loadFXMLPage
import javafx.stage.Stage; //导入方法依赖的package包/类
public BaseController loadFXMLPage(String title, FXMLPage fxmlPage, boolean cache) {
SoftReference<? extends BaseController> parentNodeRef = cacheNodeMap.get(fxmlPage);
if (cache && parentNodeRef != null) {
return parentNodeRef.get();
}
URL skeletonResource = Thread.currentThread().getContextClassLoader().getResource(fxmlPage.getFxml());
FXMLLoader loader = new FXMLLoader(skeletonResource);
Parent loginNode;
try {
loginNode = loader.load();
BaseController controller = loader.getController();
dialogStage = new Stage();
dialogStage.setTitle(title);
dialogStage.getIcons().add(new Image("image/icon.png"));
dialogStage.initModality(Modality.APPLICATION_MODAL);
dialogStage.initOwner(getPrimaryStage());
dialogStage.setScene(new Scene(loginNode));
dialogStage.setMaximized(false);
dialogStage.setResizable(false);
dialogStage.show();
controller.setDialogStage(dialogStage);
SoftReference<BaseController> softReference = new SoftReference<>(controller);
cacheNodeMap.put(fxmlPage, softReference);
return controller;
} catch (IOException e) {
AlertUtil.showErrorAlert(e.getMessage());
}
return null;
}
示例13: initialize
import javafx.stage.Stage; //导入方法依赖的package包/类
public void initialize(Stage stage) {
String maximized = propertyStore.getProperty(PropertyKey.STAGE_MAXIMIZED);
if (maximized != null && Boolean.parseBoolean(maximized)) {
stage.setMaximized(true);
}
stage.maximizedProperty().addListener((v, o, n) -> propertyStore.setProperty(PropertyKey.STAGE_MAXIMIZED, "" + n));
}
示例14: startApp
import javafx.stage.Stage; //导入方法依赖的package包/类
private void startApp(Stage primaryStage) {
primaryStage.setTitle("设备模拟客户端");
primaryStage.setScene(new Scene(MainView.getInstance()));
primaryStage.setMaximized(true);
primaryStage.setOnCloseRequest(event -> NettyLauncher.getInstance().shutdown());
primaryStage.show();
MainView.getInstance().updateGroupCount(10);
}
示例15: start
import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) {
HostServiceSingleton.setInstance(getHostServices()); //weigl: ???
this.mainScene = new StvsMainScene();
this.primaryStage = new Stage();
Platform.setImplicitExit(true);
primaryStage.setTitle(StvsVersion.getWindowTitle());
primaryStage.setScene(mainScene.getScene());
primaryStage.setMaximized(mainScene.shouldBeMaximizedProperty().get());
primaryStage.getIcons().addAll(
new Image(StvsApplication.class.getResourceAsStream("logo_large.png")),
new Image(StvsApplication.class.getResourceAsStream("logo.png")));
mainScene.shouldBeMaximizedProperty().bind(primaryStage.maximizedProperty());
mainScene.getScene().getStylesheets().add(
StvsApplication.class.getResource("normal.css").toExternalForm()
);
CSSFX.start(mainScene.getScene());
//Debugger snippet for finding the styleclasses for the node under cursor.
mainScene.getScene().addEventFilter(MouseEvent.MOUSE_MOVED, mouseEvent -> {
if (mouseEvent.isAltDown() && mouseEvent.isControlDown()) {
try {
Node node = (Node) mouseEvent.getTarget();
ObservableList<String> classes = node.getStyleClass();
System.out.println("Classes of " + node.getClass().getSimpleName() + " are " + classes);
System.out.println("Style of " + node.getClass().getSimpleName() + ": " + node.getStyle());
System.out.println(((TitledPane) node).getAlignment());
System.out.println(((TitledPane) node).getTextAlignment());
} catch (ClassCastException e) {
}
}
});
if (System.getProperty("presentation", "false").equals("true")) {
mainScene.getScene().getStylesheets().add(
StvsApplication.class.getResource("presentation.css").toExternalForm()
);
}
if (mainScene.getRootController().getRootModel().isFirstStart()) {
new WelcomeWizard(mainScene.getRootController().getRootModel().getGlobalConfig())
.showAndWait();
}
primaryStage.show();
}