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: 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 4
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 5
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 6
Project: FYS_T3   File: submitController.java   Source Code and License 7 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 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;
}
 
Example 41
Project: flexfx   File: UtilityServiceImpl.java   Source Code and License 5 votes vote down vote up
@Override
public final void populateWrapper(final ControllerWrapper wrapper, final String fxmlFile) throws IOException, ClassCastException
{
    final ClassLoader ccl = Thread.currentThread().getContextClassLoader();
    try
    {
        Thread.currentThread().setContextClassLoader(wrapper.getControllerClass().getClassLoader());
        final Field controllerField = wrapper.getClass().getDeclaredField(ControllerWrapper.CONTROLLER_FIELD_NAME);
        controllerField.setAccessible(true);
        final Field parentNodeField = wrapper.getClass().getDeclaredField(ControllerWrapper.NODE_FIELD_NAME);
        parentNodeField.setAccessible(true);
        final FXMLLoader loader = new FXMLLoader(wrapper.getControllerClass().getResource(fxmlFile));
        final Parent parentNode = loader.load();
        controllerField.set(wrapper, wrapper.getControllerClass().cast(loader.getController()));
        parentNodeField.set(wrapper, parentNode);
    }
    catch (IllegalAccessException | NoSuchFieldException exception)
    {
        // Safe to capture here as in full control of the ControllerWrapper source and hence field access and
        // field availability. We should never arrive here, at least not in production.
        throw new RuntimeException(exception);
    }
    finally
    {
        Thread.currentThread().setContextClassLoader(ccl);
    }
}
 
Example 42
Project: Luna-Exam-Builder   File: GenerateExamsCtrl.java   Source Code and License 5 votes vote down vote up
@FXML private void goToOverview() throws IOException {
	//Get the current width and height to make the transition consistent
	double w = MainApp.window.getScene().getWidth(),h = MainApp.window.getScene().getHeight();
	//load the FXML
	Parent root = FXMLLoader.load(getClass().getResource("Overview.fxml"));
	//Set the scene in the window
	MainApp.window.setScene(new Scene(root,w,h));
}
 
Example 43
Project: Lernkartei_2017   File: CreateDoorView.java   Source Code and License 5 votes vote down vote up
@Override
public Parent constructContainer()
{
	bp.setId("loginviewbg");
	
	AllFields = new VBox(50);
	AllFields.setAlignment(Pos.CENTER);
	AllFields.setMaxWidth(300);
	AllFields.setPadding(new Insets(20));
	
	Identifier = new HBox();
	Status = new HBox();
	Bottom = new HBox();
	
	inputName = new TextField();
	inputName.setPromptText("Names der Door");
	inputName.setAlignment(Pos.CENTER_LEFT);
	
	name = new Label("Name:");
	status = new Label("Status:");
	statusValue = new Label("{Door bereits vorhanden}");

	btnCreate = new AppButton("Erstellen");
	back = new BackButton(getFXController(),"Abbrechen");
	
	Identifier.getChildren().addAll(name,inputName);
	Status.getChildren().addAll(status,statusValue);
	Bottom.getChildren().addAll(back,btnCreate);
	AllFields.getChildren().addAll(Identifier,Status,Bottom);
	
	bp.setCenter(AllFields);
	
	/*
	btnCreate.setOnAction(e -> getFXController().showView("serverdoorview"));
	--Listenter to crete a door
	*/
	
	
	return bp;
}
 
Example 44
Project: JavaFx-Material-Design   File: Main.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("Slider.fxml"));
	Scene scene = new Scene(root);
	stage.setScene(scene);
	stage.show();
	
}
 
Example 45
Project: LivroJavaComoProgramar10Edicao   File: Painter.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("Painter.fxml"));
   
   Scene scene = new Scene(root);
   stage.setTitle("Painter"); // displayed in window's title bar
   stage.setScene(scene);
   stage.show();
}
 
Example 46
Project: jmonkeybuilder   File: TabToolComponent.java   Source Code and License 5 votes vote down vote up
/**
 * Handle a click to a tab.
 */
private void processMouseClick(@NotNull final MouseEvent event) {
    final EventTarget target = event.getTarget();
    if (!(target instanceof Node)) return;

    final Node node = (Node) target;

    if (!(node instanceof Text) || node.getStyleClass().contains("tab-container")) {
        return;
    }

    final Parent label = node.getParent();

    if (!(label instanceof Label)) {
        return;
    }

    final Parent tabContainer = label.getParent();

    if (!tabContainer.getStyleClass().contains("tab-container")) {
        return;
    }

    if (isChangingTab()) {
        setChangingTab(false);
        return;
    }

    processExpandOrCollapse();
}
 
Example 47
Project: JavaFX_Tutorial   File: AppGuiTest.java   Source Code and License 5 votes vote down vote up
/**
 * Setup the test on the provided stage, setting the Resolver to be configured
 * with this class
 */
public @Override void start(Stage stage) throws Exception {
	AppGuiTest.mainStage = stage;
	MockitoAnnotations.initMocks(this);
	Resolver.init(getClass());
	Pair<Parent, MainController> result = FXController.get("view/MainView.fxml");
	stage.setScene(new Scene(result.getValue0()));
	stage.show();
}
 
Example 48
Project: countingByOnesJava   File: Main.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("sample.fxml"));
    primaryStage.setTitle("Hello World");
    primaryStage.setScene(new Scene(root, 600, 400));
    primaryStage.show();
}
 
Example 49
Project: easyMvvmFx   File: ViewListCell.java   Source Code and License 5 votes vote down vote up
@Override
protected void updateItem(T item, boolean empty) {
	super.updateItem(item, empty);
	if (empty) {
		setText(null);
		setGraphic(null);
	} else {
		setText(null);
		Node currentNode = getGraphic();
		Parent view = map(item).getRoot();
		if (currentNode == null || !currentNode.equals(view)) {
			setGraphic(view);
		}
	}
}
 
Example 50
Project: CNU_TermProject_SoftwareEngineering   File: ShoppingBasketController.java   Source Code and License 5 votes vote down vote up
@FXML
private void itemManagementButtonAction(ActionEvent event) {
    shoppingBasket.deleteBasket();
    Parent ItemManagement = null;
    try {
        ItemManagement = FXMLLoader.load(getClass().getResource("/View/ItemManagement.fxml"));
    } catch (IOException e) {
        e.printStackTrace();
    }
    Scene scene = new Scene(ItemManagement);
    Stage primaryStage = (Stage) itemMangementBtn.getScene().getWindow();
    primaryStage.setScene(scene);
}
 
Example 51
Project: CardGame   File: Launcher.java   Source Code and License 5 votes vote down vote up
public void startGame() throws Exception{
    final URL url = getResource("GameOverview.fxml");
    final FXMLLoader fxmlLoader = new FXMLLoader(url);
    GameOverviewController controller = new GameOverviewController(this);
    fxmlLoader.setController(controller);
    Parent root = fxmlLoader.load();
    Menu.hide();
    Game = new Stage();
    Game.setTitle("Game");
    Scene scene = new Scene(root,1024,630);
    //Game.setResizable(false);
    Game.setScene(scene);
    Game.show();
}
 
Example 52
Project: java-solitaire   File: FreecellGameController.java   Source Code and License 5 votes vote down vote up
@FXML protected void freecellMenuClick() throws IOException {
	boolean response = ExitWindow.display("Confirm", "Are you sure you would like to exit out of your current game and start a new Freecell Game?");
	if (response) {
		Stage main = (Stage) _gameMenu.getScene().getWindow();
		Parent freecellFXML = FXMLLoader.load(getClass().getResource("/fxml/freecellGame.fxml"));
		freecellFXML.getStylesheets().add("/stylesheets/freecellGame.css");
		Scene freecellScene = new Scene(freecellFXML);
		main.setScene(freecellScene);
		main.show();
	}	
}
 
Example 53
Project: tenhou-visualizer   File: AppController.java   Source Code and License 5 votes vote down vote up
public void openDonationRanker(ActionEvent actionEvent) throws IOException {
    Stage stage = new Stage();
    stage.initModality(Modality.APPLICATION_MODAL);
    stage.initOwner(this.tableView.getScene().getWindow());

    Parent root = FXMLLoader.load(getClass().getResource("/DonationRanker.fxml"));
    root.getStylesheets().add(this.getClass().getResource(Main.properties.getProperty("css")).toExternalForm());
    javafx.scene.Scene scene = new javafx.scene.Scene(root);
    stage.setScene(scene);
    stage.setTitle("貢ぎランク");
    stage.show();
}
 
Example 54
Project: Money-Manager   File: CashCalculateStage.java   Source Code and License 5 votes vote down vote up
@Override
	public void start(Stage CashCalculateStage) {
		try {
			Parent root = FXMLLoader.load(getClass().getResource("/view/CashCalculate.fxml"));
			Scene scene = new Scene(root,800,550);
//			scene.getStylesheets().add(getClass().getResource("SignIn.css").toExternalForm());
			CashCalculateStage.setScene(scene);
			CashCalculateStage.setResizable(false);
			CashCalculateStage.setTitle("Cash Calculate");
			CashCalculateStage.show();
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
 
Example 55
Project: LivroJavaComoProgramar10Edicao   File: TimelineAnimation.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("TimelineAnimation.fxml"));
   
   Scene scene = new Scene(root);
   
   stage.setScene(scene);
   stage.show();
}
 
Example 56
Project: AchillesFx   File: Activity.java   Source Code and License 5 votes vote down vote up
/**
 * Sets content view.
 *
 * @param layoutName the layout path
 * @param bundle     the bundle
 * @param stylePaths the style paths
 */
public void setContentView(String layoutName, ResourceBundle bundle, String... stylePaths) {
    Parent parent = null;
    FXMLLoader loader = new FXMLLoader();
    loader.setLocation(this.context.getResource(layoutName));
    loader.setController(this);
    try {
        parent = loader.load();
    } catch (IOException e) {
        logger.error("achilles error", e);
        return;
    }
    this.setContentView(parent, bundle, stylePaths);
}
 
Example 57
Project: can4eve   File: OverviewDemo.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 58
Project: JavaFx-Material-Design   File: Main.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("PopUp.fxml"));
	Scene scene = new Scene(root);
	stage.setScene(scene);
	stage.show();
	
}
 
Example 59
Project: IDBuilderFX   File: MainHome.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("HomeFXML.fxml"));
	Scene scene = new Scene(root);
	scene.getStylesheets().add(getClass().getResource("HomeCSS.css").toExternalForm());
	primaryStage.setTitle("IDBuilder - Home");
	primaryStage.setScene(scene);
	primaryStage.resizableProperty().setValue(Boolean.FALSE);
	primaryStage.show();

}
 
Example 60
Project: charts   File: SunburstChartTest.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); }
        }
    }
}