Java Code Examples for javafx.scene.Parent

The following are top voted examples for showing how to use javafx.scene.Parent. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Notebook   File: SyncFragment.java   Source Code and License 11 votes vote down vote up
@Override
public void initData(Parent node, Map<String, String> bundle) {
	progressbar = (ProgressIndicator) node.lookup("#progressbar");

	iv_sync = (ImageView) node.lookup("#iv_sync");
	iv_down = (ImageView) node.lookup("#iv_down");

	iv_sync.setOnMouseEntered(e-> {
		iv_sync.setImage(sync_enter);
	});
	iv_sync.setOnMouseExited(e-> {
		iv_sync.setImage(sync_defalt);
	});

	iv_down.setOnMouseEntered(e-> {
		iv_down.setImage(down_enter);
	});
	iv_down.setOnMouseExited(e-> {
		iv_down.setImage(down_default);
	});

	iv_down.setOnMouseClicked(e->{
		 download();
	});

	iv_sync.setOnMouseClicked(e->{
		sync();
	});
}
 
Example 2
Project: PearPlanner   File: UIManager.java   Source Code and License 8 votes vote down vote up
/**
 * Displays the StudyProfile details page
 *
 * @param profile StudyProfile for which the details should be shown.
 */
public void studyProfileDetails(StudyProfile profile) throws IOException
{
    StudyProfileController spc = new StudyProfileController(profile);

    // Load in the .fxml file:
    FXMLLoader loader = new FXMLLoader(getClass().getResource("/View/StudyProfile.fxml"));
    loader.setController(spc);
    Parent root = loader.load();

    // Set the scene:
    Stage stage = new Stage();
    stage.initModality(Modality.APPLICATION_MODAL);
    stage.setScene(new Scene(root, 550, 232));
    stage.setTitle(profile.getName());
    stage.resizableProperty().setValue(false);
    stage.getIcons().add(new Image("file:icon.png"));
    stage.showAndWait();
}
 
Example 3
Project: FYS_T3   File: submitController.java   Source Code and License 8 votes vote down vote up
@FXML
public void openSubmitAction(ActionEvent event) throws IOException {
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    final Scene hScene = new Scene(home);
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/Submit.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();

    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.setScene(hScene);
            }
        }
    });
}
 
Example 4
Project: EMBER   File: Ember.java   Source Code and License 7 votes vote down vote up
@Override
public void start(Stage stage) throws Exception {

    FXMLLoader fxmlLoader = new FXMLLoader(
            getClass().getResource("/FXML/main.fxml"));
    Parent root = (Parent) fxmlLoader.load();
    MainController mainController
            = (MainController) fxmlLoader.getController();

    DataModel model = new DataModel();
    mainController.initModel(model);
    mainController.setStage(stage);
    
    Scene scene = new Scene(root);
    scene.getStylesheets().add("/CSS/main.css");
    stage.setTitle("Ember");
    stage.getIcons().add(new Image(
            "/images/EMBER-LOGO-COLOR.png"));
    stage.setScene(scene);
    stage.setMinHeight(550);
    stage.setMinWidth(550);
    stage.show();
    stage.toFront();
}
 
Example 5
Project: Money-Manager   File: GoToOperation.java   Source Code and License 7 votes vote down vote up
public void goToHelp(double positionX, double positionY) {
	try {
		Stage HelpStage = new Stage();
		Parent root = FXMLLoader.load(getClass().getResource("/view/Help.fxml"));
		Scene scene = new Scene(root,800,550);
		HelpStage.setScene(scene);
		HelpStage.setResizable(false);
		HelpStage.getIcons().add(new Image(getClass().getResourceAsStream("/imges/purse.png")));
		HelpStage.setTitle("Help");
		HelpStage.setX(positionX);
		HelpStage.setY(positionY);
		HelpStage.show();
	} catch(Exception e) {
		e.printStackTrace();
	}
}
 
Example 6
Project: MakeSourceList4j   File: Main.java   Source Code and License 7 votes vote down vote up
@Override
public void start(Stage primaryStage) throws Exception {
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/main.fxml"));
    Parent root = fxmlLoader.load();
    primaryStage.setTitle("ソースリスト作るよ");
    primaryStage.setScene(new Scene(root, 700, 500));
    primaryStage.getIcons().add(new Image(getClass().getResourceAsStream("/icons.png")));
    primaryStage.setMinHeight(500);
    primaryStage.setMinWidth(700);
    Controller controller = fxmlLoader.getController();
    controller.init(primaryStage);
    primaryStage.setMaxHeight(500);
    primaryStage.setMaxWidth(700);


    primaryStage.show();
}
 
Example 7
Project: WebPLP   File: SevenSegmentPanel.java   Source Code and License 6 votes vote down vote up
public void setState(int state)
{
	// 0 is on, 1 is off
	for (int index = 0; index < segments.size(); index++)
	{
		int maskedBit = (state >> index) & 1;
		boolean isOn = (maskedBit == 0);

		String color = isOn ? OFF_COLOR : ON_COLOR;
		Parent segment = segments.get(index);
		for (Node section : segment.getChildrenUnmodifiable())
		{
			section.setStyle("-fx-background-color: " + color);
		}
	}
}
 
Example 8
Project: marathonv5   File: DrilldownPieChartSample.java   Source Code and License 6 votes vote down vote up
public DrilldownPieChartSample() {
    String drilldownCss = DrilldownPieChartSample.class.getResource("DrilldownChart.css").toExternalForm();

    PieChart pie = new PieChart(
            FXCollections.observableArrayList(
            A = new PieChart.Data("A", 20),
            B = new PieChart.Data("B", 30),
            C = new PieChart.Data("C", 10),
            D = new PieChart.Data("D", 40)));
    ((Parent) pie).getStylesheets().add(drilldownCss);

    setDrilldownData(pie, A, "a");
    setDrilldownData(pie, B, "b");
    setDrilldownData(pie, C, "c");
    setDrilldownData(pie, D, "d");
    getChildren().add(pie);
}
 
Example 9
Project: CalendarFX   File: DateControl.java   Source Code and License 6 votes vote down vote up
private EntryViewBase<?> doFindEntryView(Parent parent, Entry<?> entry) {
    EntryViewBase<?> result = null;

    for (Node node : parent.getChildrenUnmodifiable()) {
        if (node instanceof EntryViewBase) {
            EntryViewBase<?> base = (EntryViewBase<?>) node;
            if (base.getEntry().equals(entry)) {
                result = base;
                break;
            }
        } else if (node instanceof Parent) {
            result = doFindEntryView((Parent) node, entry);
            if (result != null) {
                break;
            }
        }
    }

    return result;
}
 
Example 10
Project: marathonv5   File: DrilldownPieChartSample.java   Source Code and License 6 votes vote down vote up
public DrilldownPieChartSample() {
    String drilldownCss = DrilldownPieChartSample.class.getResource("DrilldownChart.css").toExternalForm();

    PieChart pie = new PieChart(
            FXCollections.observableArrayList(
            A = new PieChart.Data("A", 20),
            B = new PieChart.Data("B", 30),
            C = new PieChart.Data("C", 10),
            D = new PieChart.Data("D", 40)));
    ((Parent) pie).getStylesheets().add(drilldownCss);

    setDrilldownData(pie, A, "a");
    setDrilldownData(pie, B, "b");
    setDrilldownData(pie, C, "c");
    setDrilldownData(pie, D, "d");
    getChildren().add(pie);
}
 
Example 11
Project: FYS_T3   File: searchLugController.java   Source Code and License 6 votes vote down vote up
@FXML
public void openHome(ActionEvent event) throws IOException {
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    final Scene hScene = new Scene(home);
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
    stage.centerOnScreen();

    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode() + " Made by ShaMaster");
                stage.setScene(hScene);
            }
        }
    });
}
 
Example 12
Project: Higher-Cloud-Computing-Project   File: Main.java   Source Code and License 6 votes vote down vote up
@Override
    public void start(Stage primaryStage) throws Exception{
        FXMLLoader fxmlLoader = new FXMLLoader();
        fxmlLoader.setLocation(getClass().getResource("sample.fxml"));
        Parent root = fxmlLoader.load();
        Screen screen = Screen.getPrimary ();

//        界面初始化
        Controller controller = fxmlLoader.getController();
        controller.init(primaryStage);

        Rectangle2D bounds = screen.getVisualBounds ();

        double minX = bounds.getMinX ();
        double minY = bounds.getMinY ();
        double maxX = bounds.getMaxX ();
        double maxY = bounds.getMaxY ();

        screenWidth = maxX - minX;
        screenHeight = maxY - minY;

        Scene scene = new Scene(root, (maxX - minX) * 0.6, (maxY - minY) * 0.6);

        primaryStage.setTitle ("Higher Cloud Compute Platform");
        primaryStage.setScene (scene);
		primaryStage.setFullScreen(true);
        primaryStage.show ();

    }
 
Example 13
Project: testing-video   File: Calibrate2160pHDR10_LGOLED.java   Source Code and License 6 votes vote down vote up
private static Parent overlay(int version, int display,
        YCbCr params, int yCode, String suffix) {
    double ye = params.fromLumaCode(yCode);

    Label label = new Label(getLabel(version, display, params, yCode,
            suffix));
    label.setFont(font(40));
    label.setTextFill(gray(max(0.25, min(0.5, ye))));

    BorderPane.setMargin(label, new Insets(20));
    BorderPane layout = new BorderPane();
    layout.setBackground(EMPTY);
    layout.setBottom(label);
    return layout;
}
 
Example 14
Project: SerialAssistant   File: AppDelegate.java   Source Code and License 6 votes vote down vote up
public static void showHome()
{
    try {
        FXMLLoader loader	= new FXMLLoader();
        loader.setLocation( AppDelegate.class.getResource( "view/home.fxml" ) );
        Parent root = (Parent) loader.load();

        HomeController homeController = (HomeController)loader.getController();
        homeController.init( );

        m_scene = new Scene(root, 700, 532);

        static_stage.hide();
        static_stage.setTitle("亮金跨平台串口助手V1.0.0 by brok1n");
        static_stage.setScene(m_scene);
        static_stage.show();

    }catch (IOException e)
    {}
}
 
Example 15
Project: alchem   File: LoginController.java   Source Code and License 6 votes vote down vote up
public void joinNow(ActionEvent actionEvent) {
    try {
        FXMLLoader fxmlLoader2 = new FXMLLoader(getClass().getResource("../../Resources/Layouts/register_stage.fxml"));
        Parent root2 = (Parent) fxmlLoader2.load();
        Stage stage2 = new Stage();
        stage2.setScene(new Scene(root2));
        stage2.setResizable(false);
        stage2.initModality(Modality.WINDOW_MODAL);
        stage2.initOwner(ApplicationLauncher.primaryStage);
        stage2.initStyle(StageStyle.UNDECORATED);
        stage2.showAndWait();
    } catch (Exception e1) {
    }
}
 
Example 16
Project: EMBER   File: NewTaskListWindow.java   Source Code and License 6 votes vote down vote up
/**
 * Builds the window and add events.
 * @throws IOException 
 */
public NewTaskListWindow() throws IOException {
    super();
    FXMLLoader fxmlLoader = new FXMLLoader(
            getClass().getResource("/FXML/newTaskList.fxml"));
    Parent root = (Parent) fxmlLoader.load();
    taskListController
            = (NewTaskListController) fxmlLoader.getController();

    Scene scene = new Scene(root);
    setScene(scene);
    setResizable(false);
    initStyle(StageStyle.TRANSPARENT);

    this.wantsToAdd = false;
    //After pressing 'Enter', closes this window (which returns the value)
    scene.setOnKeyPressed((final KeyEvent keyEvent) -> {
        if (keyEvent.getCode() == KeyCode.ENTER) {
            this.wantsToAdd = true;
            this.close();
        } else if (keyEvent.getCode() == KeyCode.ESCAPE) {
            this.close();
        }
    });

    //Not focusing the window means closing it
    focusedProperty().addListener((obs, wasFocused, isNowFocused) -> {
        if (!isNowFocused) {
            close();
        }
    });
}
 
Example 17
Project: vertx-generator   File: BaseController.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 18
Project: Himalaya-JavaFX   File: MainFXMLController.java   Source Code and License 6 votes vote down vote up
@Override
public void initScreen() {

    playG.refillVillages();

    displayElementsMap();
    displayPlayersInformations();

    try {
        FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("InitFXML.fxml"));
        Parent root1 = (Parent) fxmlLoader.load();
        InitFXMLController initCtrl = (InitFXMLController) (fxmlLoader.getController());
        initCtrl.lauch(playG.getBoard());
        Stage stage = new Stage();
        stage.initModality(Modality.APPLICATION_MODAL);
        stage.setTitle("Choix du placement");
        stage.setScene(new Scene(root1));
        stage.showAndWait();
    } catch (IOException ex) {
        Logger.getLogger(PlayGraphic.class.getName()).log(Level.SEVERE, null, ex);
    }

    displayElementsMap();

}
 
Example 19
Project: Java-9-Programming-Blueprints   File: PhotoViewerTopComponent.java   Source Code and License 6 votes vote down vote up
private void createScene() {
    try {
        URL location = getClass().getResource("/fxml/photoviewer.fxml");
        FXMLLoader fxmlLoader = new FXMLLoader();
        fxmlLoader.setLocation(location);
        fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());

        Parent root = (Parent) fxmlLoader.load(location.openStream());
        Scene scene = new Scene(root);
        fxPanel.setScene(scene);
        controller = (PhotoViewerController) fxmlLoader.getController();
        controller.setPhoto(photo);
    } catch (IOException ex) {
        LOGGER.log(Level.SEVERE, null, ex);
    }
}
 
Example 20
Project: Mafia-TCoS-CS319-Group2A   File: Main.java   Source Code and License 6 votes vote down vote up
@Override
public void start(Stage primaryStage) throws Exception{

    Parent root = FXMLLoader.load(getClass().getClassLoader().getResource("WelcomeScreen.fxml"));

    String image = Main.class.getClassLoader().getResource("mafia-wallpapers.jpg").toExternalForm();
    root.setStyle("-fx-background-image: url('" + image + "'); " +
                "-fx-background-position: center center; " +
                    "-fx-background-size: cover"
    );
    primaryStager = primaryStage;

    SoundManager soundManager = new SoundManager();
    soundManager.play();

    GameEngine gameEngine = GameEngine.game(); /* Nice usage of Singleton Pattern */
    gameEngine.init();

    primaryStager.setTitle("Mafia: The City of Sin");
    primaryStager.setResizable(false);
    primaryStager.setScene(new Scene(root));
    primaryStager.show();
}
 
Example 21
Project: amelia   File: MainApp.java   Source Code and License 6 votes vote down vote up
@Override
public void start(Stage stage) throws Exception {
    double x = Toolkit.getDefaultToolkit().getScreenSize().width * 0.75;
    double y = Toolkit.getDefaultToolkit().getScreenSize().height * 0.75;
    
    Parent root = FXMLLoader.load(getClass().getResource(GlobalConstants.MAIN_VIEW));
    
    Scene scene = new Scene(root,x,y);
    
    scene.getStylesheets().add(GlobalConstants.CSS);
    stage.setOnCloseRequest(event ->{
        File img = new File(LocalEnvironment.getLocalVar(Local.TMP));
        File[] files = img.listFiles();
        
        if(files != null){
            for(File f : files){
                if(f.getName().endsWith(".jpg") || f.getName().endsWith(".JPG")){
                    try {
                        Files.delete(f.toPath());
                    } catch (IOException ex) {
                        Logger.getLogger(MainApp.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
            }
        }
        System.exit(0);
    });
    
    stage.setMinWidth(x);
    stage.setMinHeight(y);
    stage.setTitle(GlobalConstants.TITLE);
    stage.setScene(scene);
    stage.show();
    stage.centerOnScreen();
}
 
Example 22
Project: AS32Java   File: Tool.java   Source Code and License 6 votes vote down vote up
public static Parent loadFxml(String path, Object controller) {
	FXMLLoader loader=new FXMLLoader();
	if(controller!=null)
	{
		loader.setController(controller);
	}
	
	try {
		loader.setLocation(new File(Config.FXML_DIRECTORY +path+".fxml").toURL());
		return loader.load();
	} catch (IOException e1) {
		// TODO Auto-generated catch block
		e1.printStackTrace();
	}
	
	return null;
}
 
Example 23
Project: ExtremeGuiMakeover   File: MovieApp.java   Source Code and License 6 votes vote down vote up
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();
}
 
Example 24
Project: ServerBrowser   File: MainController.java   Source Code and License 6 votes vote down vote up
private Parent loadFXML(final View view) {
	try {
		final FXMLLoader loader = new FXMLLoader();
		loader.setLocation(getClass().getResource(view.getFXMLPath()));
		loader.setResources(Client.lang);
		
		// Creating a new instance of the specified controller, controllers never have
		// constructor arguments, therefore this is supposedly fine.
		activeSubViewController = view.getControllerType().newInstance();
		loader.setController(activeSubViewController);
		return loader.load();
	} catch (final IOException | InstantiationException | IllegalAccessException exception) {
		Logging.error("Couldn't load view.", exception);
	}
	
	return new Label("Error loading view.");
}
 
Example 25
Project: hygene   File: HelpMenuView.java   Source Code and License 6 votes vote down vote up
/**
 * Initializes a new instance of {@link HelpMenuView}.
 *
 * @throws IOException               if there was an error locating or reading the FXML
 * @throws UIInitialisationException if there was an error initializing the provided FXML resource
 */
public HelpMenuView() throws IOException, UIInitialisationException {
    stage = new Stage();

    stage.setTitle(TITLE);

    final URL resource = getClass().getResource(HELP_MENU_VIEW);
    final Parent parent = FXMLLoader.load(resource);

    if (parent == null) {
        throw new UIInitialisationException("Could not initialize the provided FXML resource.");
    }

    final Scene rootScene = new Scene(parent);
    stage.setScene(rootScene);
}
 
Example 26
Project: LivroJavaComoProgramar10Edicao   File: CoverViewer.java   Source Code and License 5 votes vote down vote up
@Override
public void start(Stage stage) throws Exception 
{
   Parent root = 
      FXMLLoader.load(getClass().getResource("CoverViewer.fxml"));
   
   Scene scene = new Scene(root);
   stage.setTitle("Cover Viewer");
   stage.setScene(scene);
   stage.show();
}
 
Example 27
Project: IDBuilderFX   File: MainmultiFileChooser.java   Source Code and License 5 votes vote down vote up
@Override
public void start(Stage primaryStage) throws Exception {

	Parent root = FXMLLoader.load(getClass().getResource("MultifilechooserFXML.fxml"));
	Scene scene = new Scene(root);
	scene.getStylesheets().add(getClass().getResource("MultifilechooserCSS.css").toExternalForm());
	primaryStage.setTitle("IDBuilder - Select Multiple PDF Files");
	primaryStage.setScene(scene);
	primaryStage.resizableProperty().setValue(Boolean.FALSE);
	primaryStage.show();

}
 
Example 28
Project: LivroJavaComoProgramar10Edicao   File: TransitionAnimations.java   Source Code and License 5 votes vote down vote up
@Override
public void start(Stage stage) throws Exception {
   Parent root = 
      FXMLLoader.load(getClass().getResource("TransitionAnimations.fxml"));
     
   Scene scene = new Scene(root);
   stage.setTitle("TransitionAnimations");
   stage.setScene(scene);
   stage.show();
}
 
Example 29
Project: marathonv5   File: AddPropertiesStage.java   Source Code and License 5 votes vote down vote up
@Override protected Parent getContentPane() {
    root = new AddPropertiesView(issueInfo);
    okButton.setOnAction((e) -> onOK());
    cancelButton.setOnAction((e) -> dispose());
    buttonBar.getButtons().addAll(okButton, cancelButton);
    root.setBottom(buttonBar);
    root.setPrefHeight(400);
    root.setPrefWidth(500);
    return root;
}
 
Example 30
Project: SerialAssistant   File: AppDelegate.java   Source Code and License 5 votes vote down vote up
public void initView() throws Exception
{
    FXMLLoader loader	= new FXMLLoader();
    loader.setLocation( getClass().getResource( "view/loading.fxml" ) );
    Parent root = (Parent) loader.load();

    LoadingController loadingController = (LoadingController)loader.getController();
    loadingController.init( );
    m_scene = new Scene(root, 600, 400);
}
 
Example 31
Project: SunburstChart   File: Demo.java   Source Code and License 5 votes vote down vote up
private static void calcNoOfNodes(Node node) {
    if (node instanceof Parent) {
        if (((Parent) node).getChildrenUnmodifiable().size() != 0) {
            ObservableList<Node> tempChildren = ((Parent) node).getChildrenUnmodifiable();
            noOfNodes += tempChildren.size();
            for (Node n : tempChildren) { calcNoOfNodes(n); }
        }
    }
}
 
Example 32
Project: JavaFX_Tutorial   File: App.java   Source Code and License 5 votes vote down vote up
@Override
public void start(Stage mainStage) throws Exception {		
	App.mainStage = mainStage;
	App.hostServices = getHostServices();
	
	Resolver.init(App.class);
	Pair<Parent, MainController> result = FXController.get("view/MainView.fxml");
	mainStage.setScene(new Scene(result.getValue0()));
	mainStage.setTitle("Recipe Book");
	mainStage.getIcons().add(new Image("images/recipe_icon.png"));
	mainStage.show();
}
 
Example 33
Project: Lernkartei_2017   File: StatsView.java   Source Code and License 5 votes vote down vote up
@Override
public Parent constructContainer()
{

	// HBox f�r die Buttons / Controls
	controls.setAlignment(Pos.BOTTOM_CENTER);
	controls.setPadding(new Insets(15));

	// Buttons / Controls
	back.setOnAction(e -> getFXController().showMainView());
	controls.getChildren().addAll(back, learn);

	pane.setBottom(controls);

	// HBox f�r die Rankings
	rankings.setAlignment(Pos.CENTER_LEFT);
	rankings.setPadding(new Insets(15));

	// HBox f�r Diagramm
	diagram.setAlignment(Pos.CENTER);

	// HBox f�r Errors oder Meldungen -> Wird nicht Visible gesetzt.
	error.setPadding(new Insets(15));
	error.setAlignment(Pos.TOP_CENTER);
	error.getChildren().addAll(errorText);
	pane.setTop(error);

	return pane;
}
 
Example 34
Project: Java-9-Programming-Blueprints   File: MailFilter.java   Source Code and License 5 votes vote down vote up
@Override
public void start(Stage stage) throws Exception {
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/mailfilter.fxml"));
    
    Scene scene = new Scene(root);
    scene.getStylesheets().add("/styles/Styles.css");
    
    stage.setTitle("MailFilter");
    stage.setScene(scene);
    stage.show();
}
 
Example 35
Project: linkifier   File: MainApp.java   Source Code and License 5 votes vote down vote up
@Override
// Define the GUI. Stage is OS window. Scene is the content of the window.
// Note: All network connections are automatically closed on window closing - no need to handle it manually.
public void start(Stage stage) throws IOException {
	Parent root = FXMLLoader.load(getClass().getResource("/fxml/main.fxml"));

	stage.setTitle("Linkifier");
	stage.getIcons().add(new Image("/img/network.png"));
	stage.setResizable(false);
	stage.setScene(new Scene(root));
	stage.show();
}
 
Example 36
Project: AS32Java   File: BaseController.java   Source Code and License 5 votes vote down vote up
/**
 * create window
 * @param stage
 * @param root
 * @param title
 */
protected void createWindow(Stage stage,Parent root,String title) {
	Scene scene = new Scene(root);
	stage.setTitle(title);
	stage.setScene(scene);
	stage.show();
}
 
Example 37
Project: Curriculum-design-of-data-structure   File: ShowMazeMain.java   Source Code and License 5 votes vote down vote up
@Override
public void start(Stage primaryStage) throws Exception {
    Parent root = FXMLLoader.load(getClass().getResource("view/ShowMazeView.fxml"));

    Scene scene = new Scene(root);
    primaryStage.setTitle("迷宫问题");
    primaryStage.setScene(scene);
    primaryStage.show();

}
 
Example 38
Project: Curriculum-design-of-data-structure   File: ShowWeightedGraphMain.java   Source Code and License 5 votes vote down vote up
@Override
public void start(Stage primaryStage) throws Exception {
    Parent root = FXMLLoader.load(getClass().getResource("view/ShowWeightedGraphView.fxml"));

    Scene scene = new Scene(root);
    primaryStage.setScene(scene);
    primaryStage.setTitle("展示加权图");
    primaryStage.show();
}
 
Example 39
Project: PhotoScript   File: Main.java   Source Code and License 5 votes vote down vote up
@Override
public void start(Stage primaryStage) throws Exception {
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("main.fxml"));
    Parent root = fxmlLoader.load();
    controller = fxmlLoader.getController();
    controller.setStage(primaryStage);
    controller.start();

    primaryStage.setTitle("PhotoScript");

    Scene scene = new Scene(root, 1000,800 );
    primaryStage.setScene(scene);
    primaryStage.show();
}
 
Example 40
Project: marathonv5   File: FunctionStage.java   Source Code and License 5 votes vote down vote up
@Override protected Parent getContentPane() {
    BorderPane content = new BorderPane();
    content.getStyleClass().add("function-stage");
    content.setId("functionStage");
    content.setCenter(mainSplitPane);
    content.setBottom(buttonBar);
    content.setPrefSize(700, 500);
    return content;
}