本文整理汇总了Java中javafx.stage.Stage.setWidth方法的典型用法代码示例。如果您正苦于以下问题:Java Stage.setWidth方法的具体用法?Java Stage.setWidth怎么用?Java Stage.setWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.stage.Stage
的用法示例。
在下文中一共展示了Stage.setWidth方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: start
import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
LoggingDomain.CONFIG.info("Java version: " + System.getProperty("java.version"));
CalendarView calendarView = new CalendarView();
calendarView.setToday(LocalDate.now());
calendarView.setTime(LocalTime.now());
calendarView.setShowDeveloperConsole(Boolean.getBoolean("calendarfx.developer"));
GoogleCalendarAppView appView = new GoogleCalendarAppView(calendarView);
appView.getStylesheets().add(CalendarView.class.getResource("calendar.css").toExternalForm());
primaryStage.setTitle("Google Calendar");
primaryStage.setScene(new Scene(appView));
primaryStage.setWidth(1400);
primaryStage.setHeight(950);
primaryStage.centerOnScreen();
primaryStage.show();
}
示例3: start
import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(Stage stage) {
Scene scene = new Scene(new Group());
stage.setTitle("Europian Country Population");
stage.setWidth(500);
stage.setHeight(500);
ObservableList<PieChart.Data> pieChartData =
FXCollections.observableArrayList(
new PieChart.Data("Belgium", 3),
new PieChart.Data("France", 26),
new PieChart.Data("Germany", 35),
new PieChart.Data("Netherlands", 7),
new PieChart.Data("Sweden", 4),
new PieChart.Data("United Kingdom", 25));
final PieChart pieChart = new PieChart(pieChartData);
pieChart.setTitle("Country Population");
((Group) scene.getRoot()).getChildren().add(pieChart);
stage.setScene(scene);
stage.show();
}
开发者ID:PacktPublishing,项目名称:Machine-Learning-End-to-Endguide-for-Java-developers,代码行数:23,代码来源:PieChart - MainApp.java
示例4: createStage
import javafx.stage.Stage; //导入方法依赖的package包/类
public static Stage createStage (String title, int width, int height, String fxmlPath) throws IOException {
//create new stage
Stage stage = new Stage();
//set title
stage.setTitle(title);
//set width & height
stage.setWidth(width);
stage.setHeight(height);
// load fxml
Pane pane = FXMLLoader.load(new File(fxmlPath).toURI().toURL());
//add scene
Scene scene = new Scene(pane);
//set scene
stage.setScene(scene);
//show window
stage.show();
return stage;
}
示例5: setupStage
import javafx.stage.Stage; //导入方法依赖的package包/类
private void setupStage(Stage s)
{
stage = s;
s.setTitle("Pinggers Git/SVN Client");
s.setHeight(480);
s.setWidth(800);
s.setMinHeight(480);
s.setMinWidth(480);
s.centerOnScreen();
// Prevent Closing of the Main Window when it is disabled
s.addEventFilter(WindowEvent.WINDOW_CLOSE_REQUEST, event -> {
if(root.isDisable())
{
event.consume();
}
});
// Use own Exit handling (double check for isDisable ...)
s.setOnCloseRequest(event -> {
requestExit();
event.consume();
});
}
示例6: start
import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(Stage stage) {
stage.setTitle("HTMLEditor Sample");
stage.setWidth(650);
stage.setHeight(500);
Scene scene = new Scene(new Group());
VBox root = new VBox();
root.setPadding(new Insets(8, 8, 8, 8));
root.setSpacing(5);
root.setAlignment(Pos.BOTTOM_LEFT);
final HTMLEditor htmlEditor = new HTMLEditor();
htmlEditor.setPrefHeight(245);
htmlEditor.setHtmlText(INITIAL_TEXT);
final WebView browser = new WebView();
final WebEngine webEngine = browser.getEngine();
ScrollPane scrollPane = new ScrollPane();
scrollPane.getStyleClass().add("noborder-scroll-pane");
scrollPane.setStyle("-fx-background-color: white");
scrollPane.setContent(browser);
scrollPane.setFitToWidth(true);
scrollPane.setPrefHeight(180);
Button showHTMLButton = new Button("Load Content in Browser");
root.setAlignment(Pos.CENTER);
showHTMLButton.setOnAction((ActionEvent arg0) -> {
webEngine.loadContent(htmlEditor.getHtmlText());
});
root.getChildren().addAll(htmlEditor, showHTMLButton, scrollPane);
scene.setRoot(root);
stage.setScene(scene);
stage.show();
}
示例7: start
import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start( final Stage primaryStage ) throws Exception {
_primaryStage = primaryStage;
primaryStage.setTitle( "Wall-T - Teamcity Radiator" );
primaryStage.getIcons( ).addAll( UIUtils.createImage( "icons/icon.png" ) );
primaryStage.setMinWidth( MIN_WIDTH );
primaryStage.setMinHeight( MIN_HEIGHT );
primaryStage.setWidth( MIN_WIDTH );
primaryStage.setHeight( MIN_HEIGHT );
_apiMonitoringService.start( );
primaryStage.show( );
_eventBus.post( new SceneEvent( ConfigurationScene.class ) );
}
示例8: start
import javafx.stage.Stage; //导入方法依赖的package包/类
public void start() {
stage = new Stage();
stage.initModality(Modality.APPLICATION_MODAL);
stage.setTitle("Create Folder");
stage.setWidth(400);
stage.setHeight(150);
stage.setResizable(false);
Screen screen = new Screen();
Point point = screen.calculateCenter(400, 150);
stage.setX(point.getX());
stage.setY(point.getY());
CustomIcons customIcons = new CustomIcons();
stage.getIcons().add(customIcons.getLogo());
CreateFolderView createFolderView = new CreateFolderView();
Scene scene = new Scene(createFolderView.getView());
stage.setScene(scene);
stage.show();
}
示例9: start
import javafx.stage.Stage; //导入方法依赖的package包/类
public void start() {
stage = new Stage();
stage.initModality(Modality.APPLICATION_MODAL);
stage.setTitle("Create File");
stage.setWidth(400);
stage.setHeight(150);
stage.setResizable(false);
Screen screen = new Screen();
Point point = screen.calculateCenter(400, 150);
stage.setX(point.getX());
stage.setY(point.getY());
CustomIcons customIcons = new CustomIcons();
stage.getIcons().add(customIcons.getLogo());
CreateFileView createFileView = new CreateFileView();
Scene scene = new Scene(createFileView.getView());
stage.setScene(scene);
stage.show();
}
示例10: start
import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(Stage stage)
{
scene = new Scene(new AppFrame(stage));
scene.getStylesheets().add("skins/Goliath-Magma.css");
stage.setScene(scene);
stage.setTitle("Goliath Overclocking Utility V1.0 Alpha");
stage.initStyle(StageStyle.UNDECORATED);
stage.setResizable(false);
stage.setHeight(368);
stage.setWidth(750);
stage.show();
}
示例11: showMasterDetailInWindow
import javafx.stage.Stage; //导入方法依赖的package包/类
private void showMasterDetailInWindow(final Stage stage, final Database database, final MasterDetailViewFeatures features) throws JAXBException, IOException {
final Parent viewRoot = ViewFactory.createMasterDetailView(database, features);
final Rectangle clip = new Rectangle();
clip.setArcHeight(18);
clip.setArcWidth(18);
clip.widthProperty().bind(stage.widthProperty());
clip.heightProperty().bind(stage.heightProperty());
//TODO: Only clipping or PerspectiveCamera is working... :(
features.customWindowClipProperty().addListener((obs, oldVal, newVal) -> {
if (newVal) {
viewRoot.setClip(clip);
} else {
viewRoot.setClip(null);
}
});
final Scene scene = new Scene(viewRoot);
features.useCssProperty().addListener((obs, oldVal, newVal) -> {
updateStylesheets(scene, newVal);
});
updateStylesheets(scene, features.isUseCss());
scene.setFill(Color.TRANSPARENT);
scene.setCamera(new PerspectiveCamera());
if (features.isCustomWindowUI()) {
stage.initStyle(StageStyle.TRANSPARENT);
}
stage.setTitle("Movie Database");
stage.setScene(scene);
stage.setWidth(1100);
stage.setHeight(720);
stage.centerOnScreen();
stage.show();
final FeaturesDialog featuresDialog = new FeaturesDialog(stage);
featuresDialog.addFeature(new Feature("Layout & Style", "demo2-css", features.useCssProperty()));
featuresDialog.addFeature(new Feature("Image Background", "demo2-image-background",features.movieBackgroundProperty()));
featuresDialog.addFeature(new Feature("List Animation", "demo2-list-animation",features.listAnimationProperty()));
featuresDialog.addFeature(new Feature("List Shadow", "demo2-list-shadow",features.listShadowProperty()));
// featuresDialog.addFeature(new Feature("List Cache", "demo2-list-cache",features.listCacheProperty()));
featuresDialog.addFeature(new Feature("Poster Transform", "demo2-poster-transform",features.posterTransformProperty()));
featuresDialog.addFeature(new Feature("Custom Window UI", "demo2-custom-window-ui",features.customWindowUIProperty()));
featuresDialog.addFeature(new Feature("Custom Window Clip", "demo2-custom-window-clip", features.customWindowClipProperty()));
featuresDialog.show();
}
示例12: start
import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
CustomControl customControl = new CustomControl();
customControl.setText("Hello!");
stage.setScene(new Scene(customControl));
stage.setTitle("Custom Control");
stage.setWidth(300);
stage.setHeight(200);
stage.show();
}
示例13: start
import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(Stage stage) {
VBox vbox = new VBox();
Scene scene = new Scene(vbox);
stage.setTitle("Hyperlink Sample");
stage.setWidth(570);
stage.setHeight(550);
selectedImage.setLayoutX(100);
selectedImage.setLayoutY(10);
final WebView browser = new WebView();
final WebEngine webEngine = browser.getEngine();
for (int i = 0; i < captions.length; i++) {
final Hyperlink hpl = hpls[i] = new Hyperlink(captions[i]);
final Image image = images[i] =
new Image(getClass().getResourceAsStream(imageFiles[i]));
hpl.setGraphic(new ImageView (image));
hpl.setFont(Font.font("Arial", 14));
final String url = urls[i];
hpl.setOnAction((ActionEvent e) -> {
webEngine.load(url);
});
}
HBox hbox = new HBox();
hbox.setAlignment(Pos.BASELINE_CENTER);
hbox.getChildren().addAll(hpls);
vbox.getChildren().addAll(hbox, browser);
VBox.setVgrow(browser, Priority.ALWAYS);
stage.setScene(scene);
stage.show();
}
示例14: start
import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
if (primaryStage == null) {
return;
}
/* Layers */
Group backgroundLayer = new Group();
Group statesLayer = new Group();
Group selectionLayer = new Group();
Pane paintingPane = new Pane(backgroundLayer, statesLayer, selectionLayer);
paintingPane.setStyle(BACKGROUND_STYLE);
/* Top-level */
Pane contentPane = new Pane(paintingPane);
contentPane.minWidthProperty().bind(contentPane.prefWidthProperty());
contentPane.maxWidthProperty().bind(contentPane.prefWidthProperty());
ScrollPane scrollPane = new ScrollPane(contentPane);
scrollPane.setVbarPolicy(ScrollBarPolicy.ALWAYS);
scrollPane.setHbarPolicy(ScrollBarPolicy.ALWAYS);
scrollPane.setFitToHeight(true);
scrollPane.setFitToWidth(true);
scrollPane.setPannable(true);
BorderPane borderPane = new BorderPane(scrollPane);
primaryStage.setScene(new Scene(borderPane));
primaryStage.show();
primaryStage.setHeight(500);
primaryStage.setWidth(500);
contentPane.setPrefHeight(200);
contentPane.setPrefWidth(PANE_WIDTH);
/* Bind painting pane's height to the content pane */
paintingPane.minHeightProperty().bind(contentPane.minHeightProperty());
paintingPane.prefHeightProperty().bind(contentPane.prefHeightProperty());
paintingPane.maxHeightProperty().bind(contentPane.maxHeightProperty());
/* We set painting's pane width programmatically */
paintingPane.minWidthProperty().bind(paintingPane.prefWidthProperty());
paintingPane.maxWidthProperty().bind(paintingPane.prefWidthProperty());
paintingPane.setPrefWidth(2000);
double x = PANE_WIDTH - 2000;
System.out.println(x);
paintingPane.relocate(x, 0);
drawBackground(backgroundLayer, paintingPane);
drawRectangles(statesLayer);
drawSelection(selectionLayer, paintingPane);
}
示例15: start
import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(Stage stage) {
stage.setTitle("Toggle Button Sample");
stage.setWidth(250);
stage.setHeight(180);
HBox hbox = new HBox();
VBox vbox = new VBox();
Scene scene = new Scene(new Group(vbox));
stage.setScene(scene);
scene.getStylesheets().add("togglebuttonsample/ControlStyle.css");
Rectangle rect = new Rectangle();
rect.setHeight(50);
rect.setFill(Color.WHITE);
rect.setStroke(Color.DARKGRAY);
rect.setStrokeWidth(2);
rect.setArcHeight(10);
rect.setArcWidth(10);
final ToggleGroup group = new ToggleGroup();
group.selectedToggleProperty().addListener(
(ObservableValue<? extends Toggle> ov,
Toggle toggle, Toggle new_toggle) -> {
if (new_toggle == null)
rect.setFill(Color.WHITE);
else
rect.setFill((Color) group.getSelectedToggle().getUserData());
});
ToggleButton tb1 = new ToggleButton("Minor");
tb1.setToggleGroup(group);
tb1.setUserData(Color.LIGHTGREEN);
tb1.setSelected(true);
tb1.getStyleClass().add("toggle-button1");
ToggleButton tb2 = new ToggleButton("Major");
tb2.setToggleGroup(group);
tb2.setUserData(Color.LIGHTBLUE);
tb2.getStyleClass().add("toggle-button2");
ToggleButton tb3 = new ToggleButton("Critical");
tb3.setToggleGroup(group);
tb3.setUserData(Color.SALMON);
tb3.getStyleClass().add("toggle-button3");
hbox.getChildren().addAll(tb1, tb2, tb3);
vbox.getChildren().add(new Label("Priority:"));
vbox.getChildren().add(hbox);
vbox.getChildren().add(rect);
vbox.setPadding(new Insets(20, 10, 10, 20));
stage.show();
rect.setWidth(hbox.getWidth());
}