當前位置: 首頁>>代碼示例>>Java>>正文


Java AnchorPane類代碼示例

本文整理匯總了Java中javafx.scene.layout.AnchorPane的典型用法代碼示例。如果您正苦於以下問題:Java AnchorPane類的具體用法?Java AnchorPane怎麽用?Java AnchorPane使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AnchorPane類屬於javafx.scene.layout包,在下文中一共展示了AnchorPane類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: start

import javafx.scene.layout.AnchorPane; //導入依賴的package包/類
@Override
public void start(Stage primaryStage) throws Exception {

    this.primaryStage = primaryStage;
    Parent root = new AnchorPane();
    Scene scene = new Scene(root);
    primaryStage.setScene(scene);
    primaryStage.getIcons().add(new Image(SQUID_LOGO_SANS_TEXT_URL));
    primaryStage.setTitle("Squid 3.0 pre-release");

    // this produces non-null window after .show()
    primaryStageWindow = primaryStage.getScene().getWindow();

    primaryStage.setOnCloseRequest((WindowEvent e) -> {
        Platform.exit();
        System.exit(0);
    });

    // postpone loading to allow for stage creation and use in controller
    scene.setRoot(FXMLLoader.load(getClass().getResource("SquidUIController.fxml")));
    primaryStage.show();
    primaryStage.setMinHeight(scene.getHeight() + 15);
    primaryStage.setMinWidth(scene.getWidth());

    squidAboutWindow = new SquidAboutWindow(primaryStage);
}
 
開發者ID:CIRDLES,項目名稱:Squid,代碼行數:27,代碼來源:SquidUI.java

示例2: reloadRomsBtnAction

import javafx.scene.layout.AnchorPane; //導入依賴的package包/類
@FXML
void reloadRomsBtnAction() throws IOException {
	
	JFXSpinner spinner = new JFXSpinner();
	spinner.setPrefSize(30, 30);
	spinner.setStyle(" -fx-background-color: #f4f4f4;");
	main.getPane().getChildren().add(spinner);
	AnchorPane.setTopAnchor(spinner, (main.getPane().getHeight()-spinner.getPrefHeight())/2);
   	AnchorPane.setLeftAnchor(spinner, (main.getPane().getWidth()-spinner.getPrefWidth())/2);
   	
   	Thread thread = new Thread(new Runnable() {
		@Override
		public void run() {
			dbController.loadRomDirectory(getRomPath()); // reload the rom directory
			
			Platform.runLater(() -> {
				refreshUIData(); // refresh the list of games displayed on screen
				main.getPane().getChildren().remove(spinner);
               });
		}
	});
	thread.start();
}
 
開發者ID:Seil0,項目名稱:cemu_UI,代碼行數:24,代碼來源:MainWindowController.java

示例3: showGithubLoginDialog

import javafx.scene.layout.AnchorPane; //導入依賴的package包/類
public GithubLoginDialogController showGithubLoginDialog(){
    GithubLoginDialogController controller = null;
    try {
        FXMLLoader loader = new FXMLLoader(getClass().getClassLoader().getResource("com/kaanburaksener/octoUML/src/view/fxml/githubLoginDialog.fxml"));
        AnchorPane page = loader.load();
        Stage dialogStage = new Stage();
        dialogStage.initModality(Modality.WINDOW_MODAL);
        dialogStage.initOwner(this.stage);
        dialogStage.setScene(new Scene(page));

        controller = loader.getController();
        controller.setDialogStage(dialogStage);
        dialogStage.showAndWait();

    } catch (IOException e){
        e.printStackTrace();
    }

    return controller;
}
 
開發者ID:kaanburaksener,項目名稱:octoBubbles,代碼行數:21,代碼來源:TabController.java

示例4: start

import javafx.scene.layout.AnchorPane; //導入依賴的package包/類
@Override public void start(Stage stage) {
    AnchorPane pane = new AnchorPane(xAxis, yAxis, grid);

    AnchorPane.setTopAnchor(yAxis, 0d);
    AnchorPane.setBottomAnchor(yAxis, 25d);
    AnchorPane.setLeftAnchor(yAxis, 0d);

    AnchorPane.setLeftAnchor(xAxis, 25d);
    AnchorPane.setRightAnchor(xAxis, 0d);
    AnchorPane.setBottomAnchor(xAxis, 0d);

    AnchorPane.setTopAnchor(grid, 0d);
    AnchorPane.setRightAnchor(grid, 0d);
    AnchorPane.setBottomAnchor(grid, 25d);
    AnchorPane.setLeftAnchor(grid, 25d);

    Scene scene = new Scene(pane);

    stage.setTitle("GridTest");
    stage.setScene(scene);
    stage.show();

    //Helper.saveAsPng(pane, "/Users/hansolo/Desktop/grid.png");
}
 
開發者ID:HanSolo,項目名稱:charts,代碼行數:25,代碼來源:GridTest.java

示例5: AnchorPaneSample

import javafx.scene.layout.AnchorPane; //導入依賴的package包/類
public AnchorPaneSample() {

    AnchorPane anchorPane = new AnchorPane();

    Label label1 = new Label("We are all in an AnchorPane.");        
    ImageView imageView = new ImageView(ICON_48);
    Button button1 = new Button("Submit");

    anchorPane.getChildren().addAll(label1, imageView, button1);

    AnchorPane.setTopAnchor(label1, Double.valueOf(2));
    AnchorPane.setLeftAnchor(label1, Double.valueOf(20));
    AnchorPane.setTopAnchor(button1, Double.valueOf(40));
    AnchorPane.setLeftAnchor(button1, Double.valueOf(20));
    AnchorPane.setTopAnchor(imageView, Double.valueOf(75));
    AnchorPane.setLeftAnchor(imageView, Double.valueOf(20));

    getChildren().add(anchorPane);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:20,代碼來源:AnchorPaneSample.java

示例6: initGraphics

import javafx.scene.layout.AnchorPane; //導入依賴的package包/類
private void initGraphics() {
    if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 ||
        Double.compare(getHeight(), 0.0) <= 0) {
        if (getPrefWidth() > 0 && getPrefHeight() > 0) {
            setPrefSize(getPrefWidth(), getPrefHeight());
        } else {
            setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    checkForAxis();

    adjustChartRange();

    adjustAxisAnchors();

    pane = new AnchorPane(xyPane);
    pane.getChildren().addAll(axis);
    setGrid(grid);

    getChildren().setAll(pane);
}
 
開發者ID:HanSolo,項目名稱:charts,代碼行數:23,代碼來源:XYChart.java

示例7: initGraphics

import javafx.scene.layout.AnchorPane; //導入依賴的package包/類
private void initGraphics() {
    if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 ||
        Double.compare(getHeight(), 0.0) <= 0) {
        if (getPrefWidth() > 0 && getPrefHeight() > 0) {
            setPrefSize(getPrefWidth(), getPrefHeight());
        } else {
            setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    validateSeries();

    pane = new AnchorPane(yPane);

    getChildren().setAll(pane);
}
 
開發者ID:HanSolo,項目名稱:charts,代碼行數:17,代碼來源:YChart.java

示例8: loadScreenPlay

import javafx.scene.layout.AnchorPane; //導入依賴的package包/類
@Autor("Divino Matheus")
private void loadScreenPlay(String path) throws IOException {
	
	AnchorPane pane = FXMLLoader.load(getClass().getResource(path));
	    
           if (path.substring(6, path.length()).equals("LayoutTelaInicial.fxml")) {
               pane.getStylesheets().add("css/buttonStyle.css");
           } else if(path.substring(6, path.length()).equals("LayoutTelaVencedor.fxml")) {
               pane.getStylesheets().add("css/layoutTelaVencedor.css");
           } else if(path.substring(6, path.length()).equals("LayoutTelaCreditos.fxml")) {
               pane.getStylesheets().add("css/layoutTelaCreditos.css");
           }
	
	Scene scene = new Scene(pane, 800, 600);
	ApplicationShowMilhao.changeScene(scene);		
}
 
開發者ID:tadeuespindolapalermo,項目名稱:ShowMilhaoPOOJava,代碼行數:17,代碼來源:ControllerLayoutPrincipal.java

示例9: loadScreenPlay

import javafx.scene.layout.AnchorPane; //導入依賴的package包/類
/**
 * Método que inicia a view LayoutNome para o jogador digitar o nome	 
 */
private void loadScreenPlay(String path) throws IOException {				
	AnchorPane pane = FXMLLoader.load(getClass().getResource(path));
       if (path.substring(6, path.length()).equals("LayoutTelaInicial.fxml")) {
           pane.getStylesheets().add("css/buttonStyle.css");
       } else if (path.substring(6, path.length()).equals("LayoutTelaPerguntas.fxml")) {
           pane.getStylesheets().add("css/buttonDialogStyle.css");
       } else if (path.substring(6, path.length()).equals("LayoutRanking.fxml")) {
           pane.getStylesheets().add("css/layoutRanking.css");
       } else if (path.substring(6, path.length()).equals("LayoutTelaRegras.fxml")){        	
           pane.getStylesheets().add("css/layoutTelaRegras.css");
       } else if (path.substring(6, path.length()).equals("LayoutNome.fxml")){
           pane.getStylesheets().add("css/buttonDialogStyle.css");
       }		
	Scene scene = new Scene(pane, 800, 600);
	ApplicationShowMilhao.changeScene(scene);		
}
 
開發者ID:tadeuespindolapalermo,項目名稱:ShowMilhaoPOOJava,代碼行數:20,代碼來源:ControllerLayoutInicial.java

示例10: start

import javafx.scene.layout.AnchorPane; //導入依賴的package包/類
@Override
public void start(Stage primaryStage) {
	try {
		AnchorPane root = (AnchorPane)FXMLLoader.load(getClass().getResource("LogInScreen.fxml")); 
		Scene scene = new Scene(root, 340, 370);
	    scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
		primaryStage.setTitle("QuickNote Plus - Log in");
		primaryStage.setScene(scene);
		primaryStage.setResizable(false);
		primaryStage.show();
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
開發者ID:NN-DMt,項目名稱:QuickNote_Plus,代碼行數:15,代碼來源:main.java

示例11: showMainMenu

import javafx.scene.layout.AnchorPane; //導入依賴的package包/類
public void showMainMenu() {
    try {
        // Load person overview.
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(Main.class.getResource("/main/java/view/MainMenu.fxml"));
        AnchorPane mainAnchor = (AnchorPane) loader.load();
        
        MainMenuController controller = loader.getController();
        controller.setMainApp(this);
        
        primaryStage.getScene().setRoot(mainAnchor);
        
        if(OptionManager.isFullscreen())
            primaryStage.setFullScreen(true);
        else
            primaryStage.setFullScreen(false);

        // Set person overview into the center of root layout.
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
開發者ID:Plinz,項目名稱:Hive_Game,代碼行數:23,代碼來源:Main.java

示例12: showNewGameScreen

import javafx.scene.layout.AnchorPane; //導入依賴的package包/類
public void showNewGameScreen(){
    try {
        // Load person overview.
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(Main.class.getResource("/main/java/view/NewGameScreen.fxml"));
        AnchorPane mainAnchor = (AnchorPane) loader.load();
        
        NewGameScreenController controller = loader.getController();
        controller.setMainApp(this);
        controller.majColorButton();
        
        primaryStage.getScene().setRoot(mainAnchor);
        if(OptionManager.isFullscreen())
            primaryStage.setFullScreen(true);
        else
            primaryStage.setFullScreen(false);
        

        // Set person overview into the center of root layout.
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
開發者ID:Plinz,項目名稱:Hive_Game,代碼行數:24,代碼來源:Main.java

示例13: showLoadGameScreen

import javafx.scene.layout.AnchorPane; //導入依賴的package包/類
public void showLoadGameScreen(){
    try {
        // Load person overview.
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(Main.class.getResource("/main/java/view/LoadGameScreen.fxml"));
        AnchorPane mainAnchor = (AnchorPane) loader.load();
        
        LoadGameScreenController controller = loader.getController();
        controller.setMainApp(this);
        controller.initGameList();
        
        primaryStage.getScene().setRoot(mainAnchor);
        if(OptionManager.isFullscreen())
            primaryStage.setFullScreen(true);
        else
            primaryStage.setFullScreen(false);

        // Set person overview into the center of root layout.
    } catch (IOException e) {
        e.printStackTrace();
    }
    
}
 
開發者ID:Plinz,項目名稱:Hive_Game,代碼行數:24,代碼來源:Main.java

示例14: showOptionsScreen

import javafx.scene.layout.AnchorPane; //導入依賴的package包/類
public void showOptionsScreen(){
    try {
        // Load person overview.
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(Main.class.getResource("/main/java/view/OptionsScreen.fxml"));
        AnchorPane mainAnchor = (AnchorPane) loader.load();
        
        OptionsScreenController controller = loader.getController();
        controller.setMainApp(this);
            
        controller.init();
        primaryStage.getScene().setRoot(mainAnchor);
        if(OptionManager.isFullscreen())
            primaryStage.setFullScreen(true);
        else
            primaryStage.setFullScreen(false);
        

        // Set person overview into the center of root layout.
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
開發者ID:Plinz,項目名稱:Hive_Game,代碼行數:24,代碼來源:Main.java

示例15: showNitriteOverview

import javafx.scene.layout.AnchorPane; //導入依賴的package包/類
private void showNitriteOverview() {
    try {
        // Load person overview.
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(getClass().getClassLoader().getResource("NitriteOverview.fxml"));
        AnchorPane personOverview = loader.load();

        final NitriteOverviewController overViewController = loader.getController();
        if (rootController != null && overViewController != null) {
            rootController.closeHandler(overViewController::close);
            overViewController.init(dbDetails);
            rootLayout.setCenter(personOverview);
        }
    } catch (Throwable t) {
        showErrorDialog(t);
        Platform.exit();
    }
}
 
開發者ID:dizitart,項目名稱:nitrite-database,代碼行數:19,代碼來源:NitriteManager.java


注:本文中的javafx.scene.layout.AnchorPane類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。