Java Code Examples for javafx.stage.Stage#setWidth()
The following examples show how to use
javafx.stage.Stage#setWidth() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BetonQuestEditor.java From BetonQuest-Editor with GNU General Public License v3.0 | 6 votes |
/** * Creates a pop-up window with specified parameters and returns the controller object. * * @param fxml path of the FXML resource file * @param title ID of translated window title message * @param width width of the window * @param height height of the window * @return the controller oject for this window */ public static Object createWindow(String fxml, String title, int width, int height) { try { Stage window = new Stage(); URL location = BetonQuestEditor.class.getResource(fxml); ResourceBundle resources = ResourceBundle.getBundle("pl.betoncraft.betonquest.editor.resource.lang.lang", Persistence.getSettings().getLanguage()); FXMLLoader fxmlLoader = new FXMLLoader(location, resources); Parent root = (Parent) fxmlLoader.load(); Scene scene = new Scene(root); scene.getStylesheets().add(BetonQuestEditor.class.getResource("resource/style.css").toExternalForm()); window.setScene(scene); window.setTitle(resources.getString(title)); window.getIcons().add(new Image(BetonQuestEditor.class.getResourceAsStream("resource/icon.png"))); window.setHeight(height); window.setWidth(width); window.setResizable(false); window.initModality(Modality.WINDOW_MODAL); window.initOwner(instance.stage); return fxmlLoader.getController(); } catch (IOException e) { ExceptionController.display(e); return null; } }
Example 2
Source File: NavigationTabsDemo.java From phoebus with Eclipse Public License 1.0 | 5 votes |
@Override public void start(final Stage stage) { final NavigationTabs nav_tabs = new NavigationTabs(); final List<String> tabs = IntStream.range(1, 10).mapToObj(i -> "Step" + i).collect(Collectors.toList()); nav_tabs.setTabs(tabs); nav_tabs.setTabSize(80, 40); nav_tabs.setTabSpacing(5); nav_tabs.getBodyPane().getChildren().setAll(new Label(" Go on, select something!")); nav_tabs.addListener(index -> { System.out.println("User selected tab " + index); final Label label = new Label("You selected tab " + (index + 1)); label.setLayoutX(index * 10); label.setLayoutY(index * 15); nav_tabs.getBodyPane().getChildren().setAll(label); }); nav_tabs.selectTab(2); final Button direction = new Button("Change direction"); direction.setOnAction(e -> nav_tabs.setDirection(Direction.values()[1 - nav_tabs.getDirection().ordinal()])); final BorderPane layout = new BorderPane(); layout.setCenter(nav_tabs); layout.setBottom(direction); final Scene scene = new Scene(layout); // Enable scene debugging? // ScenicView.show(scene); JFXRepresentation.setSceneStyle(scene); stage.setTitle("Navigation Tab Demo"); stage.setScene(scene); stage.setWidth(800); stage.setHeight(600); stage.show(); }
Example 3
Source File: UndecoratorController.java From DevToolBox with GNU Lesser General Public License v2.1 | 5 votes |
public void restoreSavedBounds(Stage stage, boolean fullscreen) { stage.setX(savedBounds.getMinX()); stage.setY(savedBounds.getMinY()); stage.setWidth(savedBounds.getWidth()); stage.setHeight(savedBounds.getHeight()); savedBounds = null; }
Example 4
Source File: LocalServerGeoprocessingSample.java From arcgis-runtime-samples-java with Apache License 2.0 | 5 votes |
@Override public void start(Stage stage) throws IOException { // set up the scene FXMLLoader loader = new FXMLLoader(getClass().getResource("/local_server_geoprocessing/main.fxml")); Parent root = loader.load(); controller = loader.getController(); Scene scene = new Scene(root); // set up the stage stage.setTitle("Local Server Geoprocessing Sample"); stage.setWidth(800); stage.setHeight(700); stage.setScene(scene); stage.show(); }
Example 5
Source File: TimeSeriesChartFXDemo1.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
@Override public void start(Stage stage) throws Exception { XYDataset dataset = createDataset(); JFreeChart chart = createChart(dataset); ChartViewer viewer = new ChartViewer(chart); stage.setScene(new Scene(viewer)); stage.setTitle("JFreeChart: TimeSeriesFXDemo1.java"); stage.setWidth(700); stage.setHeight(390); stage.show(); }
Example 6
Source File: PieChartFXDemo1.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
@Override public void start(Stage stage) throws Exception { PieDataset dataset = createDataset(); JFreeChart chart = createChart(dataset); ChartViewer viewer = new ChartViewer(chart); stage.setScene(new Scene(viewer)); stage.setTitle("JFreeChart: PieChartFXDemo1.java"); stage.setWidth(700); stage.setHeight(390); stage.show(); }
Example 7
Source File: DoughnutChartSample.java From mars-sim with GNU General Public License v3.0 | 5 votes |
@Override public void start(Stage stage) { stage.setTitle("Imported Fruits"); stage.setWidth(500); stage.setHeight(500); ObservableList<PieChart.Data> pieChartData = createData(); final DoughnutChart chart = new DoughnutChart(pieChartData); chart.setTitle("Imported Fruits"); Scene scene = new Scene(new StackPane(chart)); stage.setScene(scene); stage.show(); }
Example 8
Source File: BlendRendererSample.java From arcgis-runtime-samples-java with Apache License 2.0 | 5 votes |
@Override public void start(Stage stage) throws IOException { // set up the scene FXMLLoader loader = new FXMLLoader(getClass().getResource("/blend_renderer/main.fxml")); Parent root = loader.load(); controller = loader.getController(); Scene scene = new Scene(root); // set up the stage stage.setTitle("Blend Renderer Sample"); stage.setWidth(800); stage.setHeight(700); stage.setScene(scene); stage.show(); }
Example 9
Source File: GenerateOfflineMapOverridesSample.java From arcgis-runtime-samples-java with Apache License 2.0 | 5 votes |
@Override public void start(Stage stage) throws IOException { // set up the scene FXMLLoader loader = new FXMLLoader(getClass().getResource("/generate_offline_map_overrides/main.fxml")); Parent root = loader.load(); controller = loader.getController(); Scene scene = new Scene(root); // set up the stage stage.setTitle("Generate Offline Map Overrides Sample"); stage.setWidth(800); stage.setHeight(700); stage.setScene(scene); stage.show(); }
Example 10
Source File: BarChartFXDemo1.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Adds a chart viewer to the stage and displays it. * * @param stage the stage. * @throws Exception if something goes wrong. */ @Override public void start(Stage stage) throws Exception { CategoryDataset dataset = createDataset(); JFreeChart chart = createChart(dataset); ChartViewer viewer = new ChartViewer(chart); viewer.addChartMouseListener(this); stage.setScene(new Scene(viewer)); stage.setTitle("JFreeChart: BarChartFXDemo1.java"); stage.setWidth(700); stage.setHeight(390); stage.show(); }
Example 11
Source File: FXCategoryChartGestureDemo.java From mzmine3 with GNU General Public License v2.0 | 5 votes |
@Override public void start(Stage stage) throws Exception { JFreeChart chart = ChartFactory.createBarChart("Random", "Category", "value", createDataset()); EChartViewer canvas = new EChartViewer(chart); StackPane stackPane = new StackPane(); stackPane.getChildren().add(canvas); stage.setScene(new Scene(stackPane)); stage.setTitle("Chart gesture demo"); stage.setWidth(700); stage.setHeight(390); stage.show(); }
Example 12
Source File: RadioButtonDemo.java From JFoenix with Apache License 2.0 | 5 votes |
@Override public void start(Stage primaryStage) { final ToggleGroup group = new ToggleGroup(); JFXRadioButton javaRadio = new JFXRadioButton("JavaFX"); javaRadio.setPadding(new Insets(10)); javaRadio.setToggleGroup(group); JFXRadioButton jfxRadio = new JFXRadioButton("JFoenix"); jfxRadio.setPadding(new Insets(10)); jfxRadio.setToggleGroup(group); VBox vbox = new VBox(); vbox.getChildren().add(javaRadio); vbox.getChildren().add(jfxRadio); vbox.setSpacing(10); HBox hbox = new HBox(); hbox.getChildren().add(vbox); hbox.setSpacing(50); hbox.setPadding(new Insets(40, 10, 10, 120)); Scene scene = new Scene(hbox); primaryStage.setScene(scene); primaryStage.setWidth(500); primaryStage.setHeight(400); primaryStage.setTitle("JFX RadioButton Demo "); scene.getStylesheets() .add(RadioButtonDemo.class.getResource("/css/jfoenix-components.css").toExternalForm()); primaryStage.show(); }
Example 13
Source File: BarChartFXDemo1.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * Adds a chart viewer to the stage and displays it. * * @param stage the stage. * @throws Exception if something goes wrong. */ @Override public void start(Stage stage) throws Exception { CategoryDataset dataset = createDataset(); JFreeChart chart = createChart(dataset); ChartViewer viewer = new ChartViewer(chart); viewer.addChartMouseListener(this); stage.setScene(new Scene(viewer)); stage.setTitle("JFreeChart: BarChartFXDemo1.java"); stage.setWidth(700); stage.setHeight(390); stage.show(); }
Example 14
Source File: HonorMobileMapPackageExpirationDateSample.java From arcgis-runtime-samples-java with Apache License 2.0 | 4 votes |
@Override public void start(Stage stage) { try { // create stack pane and application scene StackPane stackPane = new StackPane(); Scene scene = new Scene(stackPane); scene.getStylesheets().add(getClass().getResource("/honor_mobile_map_package_expiration_date/style.css").toExternalForm()); // set title, size, and add scene to stage stage.setTitle("Honor Mobile Map Package Expiration Date Sample"); stage.setWidth(800); stage.setHeight(700); stage.setScene(scene); stage.show(); // create an overlay to display the expiration information VBox expirationMessageVbox = new VBox(6); expirationMessageVbox.setBackground(new Background(new BackgroundFill(Paint.valueOf("rgba(0,0,0,0.3)"), CornerRadii.EMPTY, Insets.EMPTY))); expirationMessageVbox.setPadding(new Insets(10.0)); expirationMessageVbox.setMaxSize(800, 150); expirationMessageVbox.setAlignment(Pos.CENTER); expirationMessageVbox.getStyleClass().add("panel-region"); // create a label to display the expiration message and expiration date Label expirationDetailsLabel = new Label(); expirationMessageVbox.getStyleClass().add("label"); // add the labels to the overlay expirationMessageVbox.getChildren().add(expirationDetailsLabel); // create a map view mapView = new MapView(); // load the mobile map package File mmpkFile = new File(System.getProperty("data.dir"), "./samples-data/mmpk/LothianRiversAnno.mmpk"); mobileMapPackage = new MobileMapPackage(mmpkFile.getAbsolutePath()); mobileMapPackage.loadAsync(); mobileMapPackage.addDoneLoadingListener(() -> { // check if the map package has expiration information and if so, has it expired yet if (mobileMapPackage.getExpiration() != null && mobileMapPackage.getExpiration().isExpired()) { // get the expiration of the mobile map package Expiration expiration = mobileMapPackage.getExpiration(); // get the expiration message String expirationMessage = expiration.getMessage(); // get the expiration date SimpleDateFormat daysHoursFormat = new SimpleDateFormat("EEE',' d MMM yyyy 'at' hh:mm:ss a", Locale.US); String expirationDate = daysHoursFormat.format(expiration.getDateTime().getTimeInMillis()); // set the expiration message to the label expirationDetailsLabel.setText(expirationMessage + "\n Mobile map package expired on: " + expirationDate + "."); // load the expired map if it is still accessible after expiration if (mobileMapPackage.getExpiration().getType() == ExpirationType.ALLOW_EXPIRED_ACCESS && mobileMapPackage.getLoadStatus() == LoadStatus.LOADED && !mobileMapPackage.getMaps().isEmpty()) { // add the map from the mobile map package to the map view mapView.setMap(mobileMapPackage.getMaps().get(0)); // show an alert if the mobile map package is not accessible after expiration } else if (mobileMapPackage.getExpiration().getType() == ExpirationType.PREVENT_EXPIRED_ACCESS) { new Alert(Alert.AlertType.ERROR, "The author of this mobile map package has disallowed access after the expiration date.").show(); } // show the map if it is not expired } else if (mobileMapPackage.getLoadStatus() == LoadStatus.LOADED && !mobileMapPackage.getMaps().isEmpty()) { // add the map from the mobile map package to the map view mapView.setMap(mobileMapPackage.getMaps().get(0)); } else { new Alert(Alert.AlertType.ERROR, "Failed to load the mobile map package.").show(); } }); // add the map view and overlay to the stack pane stackPane.getChildren().addAll(mapView, expirationMessageVbox); StackPane.setAlignment(expirationMessageVbox, Pos.CENTER); } catch (Exception e) { // on any error, display the stack trace e.printStackTrace(); } }
Example 15
Source File: BrowseWfsLayersSample.java From arcgis-runtime-samples-java with Apache License 2.0 | 4 votes |
@Override public void start(Stage stage) throws Exception { // create stack pane and JavaFX app scene StackPane stackPane = new StackPane(); Scene scene = new Scene(stackPane); scene.getStylesheets().add(getClass().getResource("/browse_wfs_layers/style.css").toExternalForm()); // set title, size, and add JavaFX scene to stage stage.setTitle("Browse WFS Layers"); stage.setWidth(800); stage.setHeight(700); stage.setScene(scene); stage.show(); // create a list view to show all of the layers in a WFS service ListView<WfsLayerInfo> wfsLayerNamesListView = new ListView<>(); wfsLayerNamesListView.setMaxSize(200, 160); // create a progress indicator progressIndicator = new ProgressIndicator(); progressIndicator.setVisible(true); // create an ArcGISMap with topographic basemap and set it to the map view map = new ArcGISMap(Basemap.createImagery()); mapView = new MapView(); mapView.setMap(map); // create a WFS service with a URL and load it wfsService = new WfsService("https://dservices2.arcgis.com/ZQgQTuoyBrtmoGdP/arcgis/services/Seattle_Downtown_Features/WFSServer?service=wfs&request=getcapabilities"); wfsService.loadAsync(); // when the WFS service has loaded, add its layer information to the list view for browsing wfsService.addDoneLoadingListener(() -> { progressIndicator.setVisible(false); if (wfsService.getLoadStatus() == LoadStatus.LOADED) { // add the list of WFS layers to the list view List<WfsLayerInfo> wfsLayerInfos = wfsService.getServiceInfo().getLayerInfos(); wfsLayerNamesListView.getItems().addAll(wfsLayerInfos); } else { Alert alert = new Alert(Alert.AlertType.ERROR, "WFS Service Failed to Load!"); alert.show(); } }); // populate the list view with layer names wfsLayerNamesListView.setCellFactory(list -> new ListCell<>() { @Override protected void updateItem(WfsLayerInfo wfsLayerInfo, boolean bln) { super.updateItem(wfsLayerInfo, bln); if (wfsLayerInfo != null) { String fullNameOfWfsLayer = wfsLayerInfo.getName(); String[] split = fullNameOfWfsLayer.split(":"); String smallName = split[1]; setText(smallName); } } }); // load the selected layer from the list view when the layer is selected wfsLayerNamesListView.getSelectionModel().selectedItemProperty().addListener(observable -> updateMap(wfsLayerNamesListView.getSelectionModel().getSelectedItem()) ); // add the controls to the stack pane stackPane.getChildren().addAll(mapView, wfsLayerNamesListView, progressIndicator); StackPane.setAlignment(wfsLayerNamesListView, Pos.TOP_LEFT); StackPane.setMargin(wfsLayerNamesListView, new Insets(10)); }
Example 16
Source File: DisplayWFSLayerSample.java From arcgis-runtime-samples-java with Apache License 2.0 | 4 votes |
@Override public void start(Stage stage) { // create stack pane and JavaFX app scene StackPane stackPane = new StackPane(); Scene scene = new Scene(stackPane); // set title, size, and add JavaFX scene to stage stage.setTitle("Display a WFS Layer"); stage.setWidth(800); stage.setHeight(700); stage.setScene(scene); stage.show(); // create an ArcGISMap with topographic basemap and set it to the map view ArcGISMap map = new ArcGISMap(Basemap.createTopographic()); mapView = new MapView(); mapView.setMap(map); // create an initial extent to load Point topLeft = new Point(-13619002.499764, 6043406.351867); Point bottomRight = new Point(-13618454.919189, 6042836.793464); Envelope initialExtent = new Envelope(topLeft, bottomRight); mapView.setViewpoint(new Viewpoint(initialExtent)); String serviceUrl = "https://dservices2.arcgis.com/ZQgQTuoyBrtmoGdP/arcgis/services/Seattle_Downtown_Features/WFSServer?service=wfs&request=getcapabilities"; String LayerName = "Seattle_Downtown_Features:Buildings"; // create a FeatureTable from the WFS service URL and name of the layer WfsFeatureTable wfsFeatureTable = new WfsFeatureTable(serviceUrl, LayerName); // set the feature request mode to manual. The table must be manually populated as panning and zooming won't request features automatically. wfsFeatureTable.setFeatureRequestMode(ServiceFeatureTable.FeatureRequestMode.MANUAL_CACHE); // create a feature layer to visualize the WFS features FeatureLayer wfsFeatureLayer = new FeatureLayer(wfsFeatureTable); // apply a renderer to the feature layer SimpleRenderer renderer = new SimpleRenderer(new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, 0xFFFF0000, 3)); wfsFeatureLayer.setRenderer(renderer); // add the layer to the map's operational layers map.getOperationalLayers().add(wfsFeatureLayer); // make an initial call to load the initial extent's data from the WFS, using the WFS spatial reference populateFeaturesFromServer(wfsFeatureTable, initialExtent); // use the navigation completed event to populate the table with the features needed for the current extent mapView.addNavigationChangedListener(navigationChangedEvent -> { // once the map view has stopped navigating if (!navigationChangedEvent.isNavigating()) { populateFeaturesFromServer(wfsFeatureTable, mapView.getVisibleArea().getExtent()); } }); // add the mapview to the stackpane stackPane.getChildren().add(mapView); }
Example 17
Source File: Sampler.java From jsilhouette with Apache License 2.0 | 4 votes |
@Override public void start(Stage primaryStage) throws Exception { URL location = getClass().getResource("sampler.fxml"); FXMLLoader fxmlLoader = new FXMLLoader(location); GridPane grid = new GridPane(); grid.setPadding(new Insets(20, 20, 20, 20)); grid.setHgap(20); grid.setVgap(20); grid.add(new Lauburu(50, 50, 50).getShape(), 0, 0); /* grid.add(new Rays(50, 50, 50, 2, 0.5, true).getShape(), 0, 0); grid.add(new Rays(50, 50, 50, 3, 0.5, true).getShape(), 1, 0); grid.add(new Rays(50, 50, 50, 4, 0.5, true).getShape(), 2, 0); grid.add(new Rays(50, 50, 50, 5, 0.5, true).getShape(), 3, 0); grid.add(new Rays(50, 50, 50, 6, 0.5, true).getShape(), 4, 0); grid.add(new Cross(50, 50, 50, 20, 0.5).getShape(), 0, 0); grid.add(r(new Cross(50, 50, 50, 20, 0.5), 45), 1, 0); grid.add(new Almond(50, 50, 50).getShape(), 2, 0); grid.add(r(new Almond(50, 50, 50), 90), 3, 0); grid.add(new Astroid(50, 50, 50).getShape(), 4, 0); grid.add(new Asterisk(50, 50, 50, 20, 2, 0).getShape(), 0, 1); grid.add(new Asterisk(50, 50, 50, 20, 3, 0).getShape(), 1, 1); grid.add(new Asterisk(50, 50, 50, 20, 4, 0).getShape(), 2, 1); grid.add(new Asterisk(50, 50, 50, 20, 5, 0).getShape(), 3, 1); grid.add(new Asterisk(50, 50, 50, 20, 6, 0).getShape(), 4, 1); grid.add(new Asterisk(50, 50, 50, 20, 2, 1).getShape(), 0, 2); grid.add(new Asterisk(50, 50, 50, 20, 3, 1).getShape(), 1, 2); grid.add(new Asterisk(50, 50, 50, 20, 4, 1).getShape(), 2, 2); grid.add(new Asterisk(50, 50, 50, 20, 5, 1).getShape(), 3, 2); grid.add(new Asterisk(50, 50, 50, 20, 6, 1).getShape(), 4, 2); grid.add(new RoundPin(30, 30, 30).getShape(), 0, 3); grid.add(new Arrow(0, 0, 100, 100).getShape(), 1, 3); grid.add(r(new Arrow(0, 0, 100, 100), -90), 2, 3); grid.add(new Arrow(0, 0, 100, 100, 0.1, 0.5).getShape(), 3, 3); grid.add(new Arrow(0, 0, 100, 100, 0.5, 0.2).getShape(), 4, 3); grid.add(new RegularPolygon(50, 50, 50, 3).getShape(), 0, 4); grid.add(new RegularPolygon(50, 50, 50, 4).getShape(), 1, 4); grid.add(new RegularPolygon(50, 50, 50, 5).getShape(), 2, 4); grid.add(new RegularPolygon(50, 50, 50, 6).getShape(), 3, 4); grid.add(new RegularPolygon(50, 50, 50, 7).getShape(), 4, 4); grid.add(new Donut(50, 50, 50, 20, 3).getShape(), 0, 5); grid.add(new Donut(50, 50, 50, 20, 4).getShape(), 1, 5); grid.add(new Donut(50, 50, 50, 20, 5).getShape(), 2, 5); grid.add(new Donut(50, 50, 50, 20, 6).getShape(), 3, 5); grid.add(new Donut(50, 50, 50, 20, 7).getShape(), 4, 5); // grid.add(new MultiRoundRectangle(0, 0, 100, 100, 51).getShape(), 0, 6); grid.add(new Star(50, 50, 50, 20, 3).getShape(), 0, 6); grid.add(new Star(50, 50, 50, 20, 4).getShape(), 1, 6); grid.add(new Star(50, 50, 50, 20, 5).getShape(), 2, 6); grid.add(new Star(50, 50, 50, 20, 6).getShape(), 3, 6); grid.add(new Star(50, 50, 50, 20, 7).getShape(), 4, 6); */ Scene scene = new Scene(grid); scene.getStylesheets().add("org/kordamp/jsilhouette/sampler.css"); primaryStage.setTitle("JSilhouette Sampler"); primaryStage.setScene(scene); primaryStage.setWidth(1024); primaryStage.setHeight(1024); primaryStage.show(); }
Example 18
Source File: EditKMLGroundOverlaySample.java From arcgis-runtime-samples-java with Apache License 2.0 | 4 votes |
@Override public void start(Stage stage) { try { // create stack pane and application scene StackPane stackPane = new StackPane(); Scene fxScene = new Scene(stackPane); fxScene.getStylesheets().add(getClass().getResource("/edit_kml_ground_overlay/style.css").toExternalForm()); // set title, size and add application scene to stage stage.setTitle("Edit KML Ground Overlay Sample"); stage.setWidth(800); stage.setHeight(700); stage.setScene(fxScene); stage.show(); // create a scene and add it to the scene view ArcGISScene scene = new ArcGISScene(Basemap.createImagery()); sceneView = new SceneView(); sceneView.setArcGISScene(scene); // create a geometry for the ground overlay Envelope overlayGeometry = new Envelope(-123.066227926904, 44.04736963555683, -123.0796942287304, 44.03878298600624, SpatialReferences.getWgs84()); // create a KML icon for the overlay image String overlayImageURI = new File(System.getProperty("data.dir"), "./samples-data/images/1944.jpg").getAbsolutePath(); KmlIcon overlayImage = new KmlIcon(overlayImageURI); // create the KML ground overlay KmlGroundOverlay kmlGroundOverlay = new KmlGroundOverlay(overlayGeometry, overlayImage); // set the rotation of the ground overlay to correct the overlay's rotation with respect to the basemap kmlGroundOverlay.setRotation(-3.046024799346924); // create a KML dataset with the ground overlay as the root node KmlDataset kmlDataset = new KmlDataset(kmlGroundOverlay); // create a KML layer using the KML dataset KmlLayer kmlLayer = new KmlLayer(kmlDataset); // add the KML layer to the scene view sceneView.getArcGISScene().getOperationalLayers().add(kmlLayer); // set the viewpoint to the ground overlay sceneView.setViewpoint(new Viewpoint(overlayGeometry, new Camera(overlayGeometry.getCenter(), 1250, 45, 60, 0))); // create a slider for adjusting the overlay opacity Slider slider = new Slider(0, 1, 1); slider.setMaxWidth(300); // add a listener to the slider's value property to set the opacity of the KML ground overlay slider.valueProperty().addListener(o -> kmlGroundOverlay.setColor(ColorUtil.colorToArgb(new Color(0, 0, 0, slider.getValue()))) ); // create a controls box VBox controlsVBox = new VBox(); controlsVBox.setBackground(new Background(new BackgroundFill(Paint.valueOf("rgba(0,0,0,0.5)"), CornerRadii.EMPTY, Insets.EMPTY))); controlsVBox.setPadding(new Insets(10.0)); controlsVBox.setSpacing(5); controlsVBox.setMaxSize(250, 20); controlsVBox.setAlignment(Pos.CENTER); controlsVBox.getStyleClass().add("panel-region"); // create a label for the slider Label label = new Label("Overlay Opacity"); // add the slider and label to the controls box controlsVBox.getChildren().addAll(label, slider); // add the scene view and controls to the stack pane stackPane.getChildren().addAll(sceneView, controlsVBox); StackPane.setAlignment(controlsVBox, Pos.TOP_LEFT); StackPane.setMargin(controlsVBox, new Insets(10, 0, 0, 10)); } catch (Exception e) { // on any error, display the stack trace. e.printStackTrace(); } }
Example 19
Source File: TimeBasedQuerySample.java From arcgis-runtime-samples-java with Apache License 2.0 | 4 votes |
@Override public void start(Stage stage) throws Exception { try { // create stack pane and application scene StackPane stackPane = new StackPane(); Scene scene = new Scene(stackPane); // size the stage, add a title, and set scene to stage stage.setTitle("Time Based Query Sample"); stage.setWidth(800); stage.setHeight(700); stage.setScene(scene); stage.show(); // create a map and set it to a map view mapView = new MapView(); ArcGISMap map = new ArcGISMap(Basemap.createOceans()); mapView.setMap(map); // create a feature table with the URL of the feature service String serviceURL = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Hurricanes/MapServer/0"; serviceFeatureTable = new ServiceFeatureTable(serviceURL); // define the request mode to manual serviceFeatureTable.setFeatureRequestMode(ServiceFeatureTable.FeatureRequestMode.MANUAL_CACHE); // load the table and set the query serviceFeatureTable.addDoneLoadingListener(() -> { if (serviceFeatureTable.getLoadStatus() == LoadStatus.LOADED) { // create query parameters QueryParameters queryParameters = new QueryParameters(); // set a time extent (beginning of time to September 16th, 2000) Calendar beg = new Calendar.Builder().setDate(1, 1, 1).build(); Calendar end = new Calendar.Builder().setDate(2000, 9, 16).build(); TimeExtent timeExtent = new TimeExtent(beg, end); queryParameters.setTimeExtent(timeExtent); // return all fields List<String> outputFields = Collections.singletonList("*"); // populate the service with features that fit the time extent, when done zoom to the layer's extent serviceFeatureTable.populateFromServiceAsync(queryParameters, true, outputFields).addDoneListener(() -> { mapView.setViewpointGeometryAsync(serviceFeatureTable.getExtent()); }); } else { new Alert(Alert.AlertType.ERROR, serviceFeatureTable.getLoadError().getMessage()).show(); } }); // create the feature layer using the service feature table FeatureLayer featureLayer = new FeatureLayer(serviceFeatureTable); // add the layer to the map map.getOperationalLayers().add(featureLayer); // add the map view to stack pane stackPane.getChildren().addAll(mapView); } catch (Exception e) { // on any error, display stack trace e.printStackTrace(); } }
Example 20
Source File: Sampler.java From ikonli with Apache License 2.0 | 4 votes |
@Override public void start(Stage primaryStage) throws Exception { URL location = getClass().getResource("sampler.fxml"); FXMLLoader fxmlLoader = new FXMLLoader(location); TabPane tabPane = fxmlLoader.load(); tabPane.getTabs().add(new DemoTab(Dashicons.class, allOf(Dashicons.class))); tabPane.getTabs().add(new DemoTab(Devicons.class, allOf(Devicons.class))); tabPane.getTabs().add(new DemoTab(Elusive.class, allOf(Elusive.class))); tabPane.getTabs().add(new DemoTab(Entypo.class, allOf(Entypo.class))); tabPane.getTabs().add(new DemoTab(Feather.class, allOf(Feather.class))); tabPane.getTabs().add(new DemoTab(FontAwesome.class, allOf(FontAwesome.class))); tabPane.getTabs().add(new DemoTab(FontAwesomeBrands.class, allOf(FontAwesomeBrands.class))); tabPane.getTabs().add(new DemoTab(FontAwesomeSolid.class, allOf(FontAwesomeSolid.class))); tabPane.getTabs().add(new DemoTab(FontAwesomeRegular.class, allOf(FontAwesomeRegular.class))); tabPane.getTabs().add(new DemoTab(Fontelico.class, allOf(Fontelico.class))); tabPane.getTabs().add(new DemoTab(Foundation.class, allOf(Foundation.class))); tabPane.getTabs().add(new DemoTab(HawconsFilled.class, allOf(HawconsFilled.class))); tabPane.getTabs().add(new DemoTab(HawconsStroke.class, allOf(HawconsStroke.class))); tabPane.getTabs().add(new DemoTab(Icomoon.class, allOf(Icomoon.class))); tabPane.getTabs().add(new DemoTab(Ionicons4Material.class, allOf(Ionicons4Material.class))); tabPane.getTabs().add(new DemoTab(Ionicons4IOS.class, allOf(Ionicons4IOS.class))); tabPane.getTabs().add(new DemoTab(Ionicons4Logo.class, allOf(Ionicons4Logo.class))); tabPane.getTabs().add(new DemoTab(Ionicons.class, allOf(Ionicons.class))); tabPane.getTabs().add(new DemoTab(LigatureSymbols.class, allOf(LigatureSymbols.class))); tabPane.getTabs().add(new DemoTab(Linecons.class, allOf(Linecons.class))); tabPane.getTabs().add(new DemoTab(Maki.class, allOf(Maki.class))); tabPane.getTabs().add(new DemoTab(Maki2.class, allOf(Maki2.class))); tabPane.getTabs().add(new DemoTab(Mapicons.class, allOf(Mapicons.class))); tabPane.getTabs().add(new DemoTab(Material.class, allOf(Material.class))); tabPane.getTabs().add(new DemoTab(MaterialDesign.class, allOf(MaterialDesign.class))); tabPane.getTabs().add(new DemoTab(MetrizeIcons.class, allOf(MetrizeIcons.class))); tabPane.getTabs().add(new DemoTab(Ociicons.class, allOf(Ociicons.class))); tabPane.getTabs().add(new DemoTab(Octicons.class, allOf(Octicons.class))); tabPane.getTabs().add(new DemoTab(Openiconic.class, allOf(Openiconic.class))); tabPane.getTabs().add(new DemoTab(PaymentFont.class, allOf(PaymentFont.class))); tabPane.getTabs().add(new DemoTab(Runestroicons.class, allOf(Runestroicons.class))); tabPane.getTabs().add(new DemoTab(Themify.class, allOf(Themify.class))); tabPane.getTabs().add(new DemoTab(Typicons.class, allOf(Typicons.class))); tabPane.getTabs().add(new DemoTab(WeatherIcons.class, allOf(WeatherIcons.class))); tabPane.getTabs().add(new DemoTab(Websymbols.class, allOf(Websymbols.class))); tabPane.getTabs().add(new DemoTab(Zondicons.class, allOf(Zondicons.class))); Scene scene = new Scene(tabPane); scene.getStylesheets().add("org/kordamp/ikonli/sampler/javafx/sampler.css"); primaryStage.setTitle("Ikonli Sampler"); primaryStage.setScene(scene); primaryStage.setWidth(1024); primaryStage.setHeight(1024); primaryStage.show(); }