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


Java Scene類代碼示例

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


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

示例1: start

import javafx.scene.Scene; //導入依賴的package包/類
@Override public void start(Stage stage) {
    StackPane pane = new StackPane(graph);
    pane.setPadding(new Insets(10));
    pane.setBackground(new Background(new BackgroundFill(Color.rgb(40, 40, 40), CornerRadii.EMPTY, Insets.EMPTY)));

    Scene scene = new Scene(pane);

    stage.setTitle("Radial Chart");
    stage.setScene(scene);
    stage.show();

    timer.start();
}
 
開發者ID:HanSolo,項目名稱:radialchart,代碼行數:14,代碼來源:Demo.java

示例2: AlertBox

import javafx.scene.Scene; //導入依賴的package包/類
public AlertBox(Stage primaryStage, FXMLLoader fxmlLoader, boolean alertType, String msg) {
    try {
        Parent root = (Parent) fxmlLoader.load();
        Scene scene = new Scene(root);
        Label alertText = (Label) scene.lookup("#alert_text");
        alertText.setText(msg);
        if (alertType == true)
            alertText.setStyle("-fx-text-fill: chartreuse");
        else
            alertText.setStyle("-fx-text-fill: red");
        Stage stage = new Stage();
        stage.setResizable(false);
        stage.initModality(Modality.WINDOW_MODAL);
        stage.initOwner(primaryStage);
        stage.initStyle(StageStyle.UNDECORATED);
        stage.setScene(scene);
        stage.showAndWait();
    } catch (Exception e) {
    }
}
 
開發者ID:alchemsynergy,項目名稱:alchem,代碼行數:21,代碼來源:AlertBox.java

示例3: start

import javafx.scene.Scene; //導入依賴的package包/類
@Override
public void start(Stage stage) throws Exception {
    Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));
    
    Scene scene = new Scene(root);
    
    stage.setScene(scene);
    stage.show();
}
 
開發者ID:kmhasan-class,項目名稱:spring2017java,代碼行數:10,代碼來源:AnimationDemoSection3.java

示例4: start

import javafx.scene.Scene; //導入依賴的package包/類
@Override
public void start(Stage stage) throws Exception {
    GroupsView groupsView = new GroupsView(stage, (DefaultSecretsGroupManager) Singleton.secretsGroupManager, Singleton.region);

    Scene scene  = new Scene(borderPane,1100,500);
    scene.getStylesheets().add("style.css");
    stage.setScene(scene);

    borderPane.getChildren().addAll(groupsView);

    stage.show();
}
 
開發者ID:schibsted,項目名稱:strongbox,代碼行數:13,代碼來源:StrongboxGUI.java

示例5: createPartControl

import javafx.scene.Scene; //導入依賴的package包/類
public void createPartControl(Composite parent) {
	fxCanvas = new FXCanvas(parent, SWT.NONE);
	eventManagerRenderer = new EventManagerRenderer();
	Scene scene = new Scene(eventManagerRenderer);
	fxCanvas.setScene(scene);

	parent.getShell().addListener(SWT.Resize, (e) -> {

	});
}
 
開發者ID:eclipse,項目名稱:gemoc-studio-modeldebugging,代碼行數:11,代碼來源:EventManagerViewPart.java

示例6: Stats

import javafx.scene.Scene; //導入依賴的package包/類
public Stats(Scene gameContextScene) {
    this.gameContextScene = gameContextScene;

    nbGoals = 0;
    beginTime = 0;
    length = 0;
    zeroTime = System.currentTimeMillis();
    lengthBetweenGoals = new ArrayList<Integer>(1000);

    log.info("GazeUtils ON : " + GazeUtils.isOn());

    if (GazeUtils.isOn()) {
        recordGazeMovements = buildRecordGazeMovements();
        GazeUtils.addStats(this);
    } else {
        recordMouseMovements = buildRecordMouseMovements();
        gameContextScene.addEventFilter(MouseEvent.ANY, recordMouseMovements);
    }

    int heatMapWidth = (int) (gameContextScene.getHeight() / heatMapPixelSize);
    int heatMapHeight = (int) (gameContextScene.getWidth() / heatMapPixelSize);
    log.info("heatMapWidth = {}, heatMapHeight = {}", heatMapWidth, heatMapHeight);
    heatMap = new double[heatMapWidth][heatMapHeight];
}
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:25,代碼來源:Stats.java

示例7: start

import javafx.scene.Scene; //導入依賴的package包/類
@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();
}
 
開發者ID:Khromium,項目名稱:MakeSourceList4j,代碼行數:18,代碼來源:Main.java

示例8: start

import javafx.scene.Scene; //導入依賴的package包/類
public void start(Stage stg) throws IOException {
    guiroot = loader.load();
    sc = new Scene(guiroot);

    contr = loader.getController();

    stg.setScene(sc);
    stg.sizeToScene();
    stg.setTitle("Plasmoxy - SentientLight/TrackMate");
    stg.setMinHeight(stg.getHeight());
    stg.setMinWidth(stg.getWidth());
    stg.show();

    stg.setOnCloseRequest(event ->
    {
        System.out.println("CLOSING");
        contr.close();
    });

    contr.init();

}
 
開發者ID:Plasmoxy,項目名稱:AquamarineLake,代碼行數:23,代碼來源:App.java

示例9: start

import javafx.scene.Scene; //導入依賴的package包/類
@Override
public void start(Stage mainWin) throws IOException {
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    DEFAULT_HEIGHT = screenSize.height - 100;
    DEFAULT_WIDTH = screenSize.width - 100;

    teamTabs = new TabPane(); // Initialize the pane with for the tabs
    setUpHelp = new GUIHelper(this); // Initialize the GUI helper class
    info = setUpHelp.createTextBox("Server not configured!"); // Initialize the textbox
    menuBar = setUpHelp.getMenu(info); // Initialize the menubar and the menus
    elementSect = new StackPane(); // Initialize the element stackpane
    elementSect.getChildren().add(teamTabs); // Add the tabs from teamtabs there
    borderPane = new BorderPane(); // Add the border pane
    borderPane.setTop(menuBar); // Add stuff to the borders
    borderPane.setCenter(elementSect); // But the elementSect in the middle
    borderPane.setBottom(info); // Put the textpane in the bottom
    Scene scene = new Scene(borderPane, DEFAULT_WIDTH, DEFAULT_HEIGHT); // Create the scene for the height
    mainWin.getIcons().add(new Image(ICON_LOC)); // Set the icon as the CyberTiger icon
    mainWin.setTitle("CyberTiger Scoreboard"); // Get the window name
    mainWin.setScene(scene); // Set the window
    mainWin.show(); // Show the window

    refreshData(); // Refresh the data since this creates the rest of teh GUI

    Timeline scoreboardRefresh = new Timeline(new KeyFrame(Duration.seconds(REFRESH_TIMEOUT), (ActionEvent event) -> {
        try {
            refreshData(); // Put the refresh method in this method to autorefresh every minute
        } catch (IOException ex) { // Catch the exception from the database conn
            info.setText("Error refreshing scores! " + ex); // Show the errors
        }
    }));
    scoreboardRefresh.setCycleCount(Timeline.INDEFINITE); // Set the number of times to run
    scoreboardRefresh.play(); // Run the timer
}
 
開發者ID:billwi,項目名稱:CyberTigerScoreboard,代碼行數:35,代碼來源:CPscorereport.java

示例10: goToTransactionHistory

import javafx.scene.Scene; //導入依賴的package包/類
public void goToTransactionHistory(double positionX, double positionY) {
	try {
		Stage TransactionHistoryStage = new Stage();
		Parent root = FXMLLoader.load(getClass().getResource("/view/TransactionHistory.fxml"));
		Scene scene = new Scene(root,800,550);
		TransactionHistoryStage.setScene(scene);
		TransactionHistoryStage.setResizable(false);
		TransactionHistoryStage.getIcons().add(new Image(getClass().getResourceAsStream("/imges/purse.png")));
		TransactionHistoryStage.setTitle("Transaction History");
		TransactionHistoryStage.setX(positionX);
		TransactionHistoryStage.setY(positionY);
		TransactionHistoryStage.show();
	} catch(Exception e) {
		e.printStackTrace();
	}
}
 
開發者ID:krHasan,項目名稱:Money-Manager,代碼行數:17,代碼來源:GoToOperation.java

示例11: start

import javafx.scene.Scene; //導入依賴的package包/類
@Override
public void start(Stage primaryStage) {
	try {
		Scene scene = new Scene(new LoginView().getView());
		scene.getStylesheets().add("css/application.css");

		primaryStage.setTitle(Constants.APP_NAME);
		primaryStage.setResizable(false);
		primaryStage.setScene(scene);
		primaryStage.getIcons().add(Constants.APP_LOGO);
		primaryStage.show();

		createShortcut();

	} catch(Exception e) {
		e.printStackTrace();
	}
}
 
開發者ID:coding-dream,項目名稱:Notebook,代碼行數:19,代碼來源:App.java

示例12: makeZoomable

import javafx.scene.Scene; //導入依賴的package包/類
public void makeZoomable(Scene scene4EventFilter, Node control4Scaling) {
    scene4EventFilter.addEventFilter(ScrollEvent.ANY, (ScrollEvent event) -> {
        double delta = 1.2;
        double scale = control4Scaling.getScaleX();

        if (ObjectUtils.smallerDoublePrecision(event.getDeltaY(), 0)) {
            scale /= delta;
        } else {
            scale *= delta;
        }

        if (scale < MIN_SCALE || scale > MAX_SCALE) {
            scale = scale < MIN_SCALE ? MIN_SCALE : MAX_SCALE;
        }

        control4Scaling.setScaleX(scale);
        control4Scaling.setScaleY(scale);

        event.consume();
    });
}
 
開發者ID:adihubba,項目名稱:javafx-3d-surface-chart,代碼行數:22,代碼來源:Mesh3DChartPanel.java

示例13: start

import javafx.scene.Scene; //導入依賴的package包/類
@Override
public void start(Stage stage) {
    stage.setTitle("HTMLEditor Sample");
    stage.setWidth(650);
    stage.setHeight(500);
    Scene scene = new Scene(new Group());

    VBox root = new VBox();     
    root.setPadding(new Insets(8, 8, 8, 8));
    root.setSpacing(5);
    root.setAlignment(Pos.BOTTOM_LEFT);
 
    final HTMLEditor htmlEditor = new HTMLEditor();
    htmlEditor.setPrefHeight(245);
    htmlEditor.setHtmlText(INITIAL_TEXT);
           
    final WebView browser = new WebView();
    final WebEngine webEngine = browser.getEngine();
    
 
    ScrollPane scrollPane = new ScrollPane();
    scrollPane.getStyleClass().add("noborder-scroll-pane");
    scrollPane.setStyle("-fx-background-color: white");
    scrollPane.setContent(browser);
    scrollPane.setFitToWidth(true);
    scrollPane.setPrefHeight(180);
 
    Button showHTMLButton = new Button("Load Content in Browser");
    root.setAlignment(Pos.CENTER);
    showHTMLButton.setOnAction((ActionEvent arg0) -> {
        webEngine.loadContent(htmlEditor.getHtmlText());
    });
    
    root.getChildren().addAll(htmlEditor, showHTMLButton, scrollPane);
    scene.setRoot(root);
 
    stage.setScene(scene);
    stage.show();
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:40,代碼來源:HTMLEditorSample.java

示例14: start

import javafx.scene.Scene; //導入依賴的package包/類
@Override
public void start(Stage primaryStage) {
	try {
		GridPane root = (GridPane)FXMLLoader.load(getClass().getClassLoader().getResource("mainMenu.fxml"));
		Scene scene = new Scene(root,400,400);
		//scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
		primaryStage.setTitle("Vier Gewinnt: Hauptmenu");
		primaryStage.setScene(scene);
		primaryStage.setResizable(false);
		primaryStage.setOnCloseRequest(event -> {
			closeAppl();
		});
		primaryStage.show();
	} catch(Exception e) {
		e.printStackTrace();
	}
}
 
開發者ID:lukasbischof,項目名稱:Orsum-occulendi,代碼行數:18,代碼來源:Main.java

示例15: showSplash

import javafx.scene.Scene; //導入依賴的package包/類
private void showSplash(final Stage initStage, Task<?> task, InitCompletionHandler initCompletionHandler) {
    progressText.textProperty().bind(task.messageProperty());
    loadProgress.progressProperty().bind(task.progressProperty());
    task.stateProperty().addListener((observableValue, oldState, newState) -> {
        if (newState == Worker.State.SUCCEEDED) {
            loadProgress.progressProperty().unbind();
            loadProgress.setProgress(1);
            initStage.toFront();
            FadeTransition fadeSplash = new FadeTransition(Duration.seconds(1.2), splashLayout);
            fadeSplash.setFromValue(1.0);
            fadeSplash.setToValue(0.0);
            fadeSplash.setOnFinished(actionEvent -> initStage.hide());
            fadeSplash.play();

            initCompletionHandler.complete();
        }
    });

    Scene splashScene = new Scene(splashLayout);
    initStage.initStyle(StageStyle.UNDECORATED);
    final Rectangle2D bounds = Screen.getPrimary().getBounds();
    initStage.setScene(splashScene);
    initStage.setX(bounds.getMinX() + bounds.getWidth() / 2 - SPLASH_WIDTH / 2);
    initStage.setY(bounds.getMinY() + bounds.getHeight() / 2 - SPLASH_HEIGHT / 2);
    initStage.show();
}
 
開發者ID:mhusam,項目名稱:ChessBot,代碼行數:27,代碼來源:ChessBotAppSplash.java


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