本文整理汇总了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();
}
示例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) {
}
}
示例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();
}
示例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();
}
示例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) -> {
});
}
示例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];
}
示例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();
}
示例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();
}
示例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
}
示例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();
}
}
示例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();
}
}
示例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();
});
}
示例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();
}
示例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();
}
}
示例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();
}