本文整理了Java中javafx.scene.Scene.setRoot()
方法的一些代码示例,展示了Scene.setRoot()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Scene.setRoot()
方法的具体详情如下:
包路径:javafx.scene.Scene
类名称:Scene
方法名:setRoot
暂无
代码示例来源:origin: stackoverflow.com
@FXML protected void handleSubmitButtonAction(ActionEvent event) {
// you just create new control, all fxml tricks are encapsulated
InnerFxmlControl root = new InnerFxmlControl();
// and you can access all its' methods and fields including matched by @FXML tag:
root.cb.getItems().add("new item");
Scene cc = buttonStatusText.getScene();
cc.setRoot(root);
}
代码示例来源:origin: org.loadui/testFx
public static void setRoot( Parent rootNode )
{
scene.setRoot( rootNode );
}
}
代码示例来源:origin: stackoverflow.com
hb.getChildren().addAll(pane, pi);
scene.setRoot(hb);
stage.show();
代码示例来源:origin: stackoverflow.com
Scene scene = new Scene(root);//scene already has a root
scene.setRoot(hb);//why do this?
//if you do not need the Group, why set it to your scene
代码示例来源:origin: stackoverflow.com
button.setOnAction(event -> {
Parent root = FXMLLoader.load(getClass().getResource("view/bambam"));
Scene scene = button.getScene();
scene.setRoot(root);
});
代码示例来源:origin: stackoverflow.com
@FXML
private BorderPane root; //root pane
@FXML
private void changeLocale(ActionEvent event) throws IOException{
Scene scene = root.getScene();
if(event.getSource().equals(lang_en)){
scene.setRoot(FXMLLoader.load(getClass().getResource("Layout.fxml"),ResourceBundle.getBundle("resources/Bundle", Locale.ENGLISH))); // = new Locale("en")
}else if(event.getSource().equals(lang_cs)){
scene.setRoot(FXMLLoader.load(getClass().getResource("Layout.fxml"),ResourceBundle.getBundle("resources/Bundle", new Locale("cs", "CZ"))));
}else{
}
}
代码示例来源:origin: stackoverflow.com
@FXML protected void click(ActionEvent event) throws Exception{
FXMLLoader fxmlLoader = new FXMLLoader();
Pane p = (Pane) fxmlLoader.load(getClass().getResource("../view/Options.fxml").openStream());
Scene scene= menu.getScene();
scene.setRoot(p);
}
代码示例来源:origin: stackoverflow.com
Pane parent = (Pane) table.getParent();
parent.getChildren().remove(table);
Scene applyCssScene = new Scene(table);
table.applyCss();
table.layout();
applyCssScene.setRoot(null);
if (parent != null) {
// Assumes that the original order in the parent does not matter.
// If it did, you would also need to keep track of the child list position.
parent.getChildren().add(table);
}
. . .
// perform css based lookup operation on the table.
代码示例来源:origin: stackoverflow.com
public class FirstController implements Initializable {
@FXML
public void handleButtonAction(ActionEvent event) throws Exception{
Node node = (Node) event.getSource();
Stage stage = (Stage) node.getScene().getWindow();
Scene scene = stage.getScene();
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Second.fxml"));
Parent root = (Parent) fxmlLoader.load();
scene.setRoot(root);
}
}
代码示例来源:origin: stackoverflow.com
Label testLabel1 = new Label("TEST1");
Label testLabel2 = new Label("TEST no. 2");
GridPane testGl = new GridPane();
testGl.add(testLabel1, 1, 1);
testGl.add(testLabel2, 2, 2);
VBox testVBox = new VBox(testGl);
Pane testPane = new Pane(testVBox);
// add testPane to some scene before layouting
Scene testScene = new Scene(testPane);
testPane.applyCss();
testPane.layout();
System.out.println(">>> " + testPane.getBoundsInLocal().getWidth());
// Pane could be removed from scene
Group replacement = new Group();
testScene.setRoot(replacement);
代码示例来源:origin: stackoverflow.com
@FXML
private Button goBtn;
Stage stage = (Stage) goBtn.getScene().getWindow();
Scene scene = goBtn.getScene();
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource("Activity.fxml"));
scene.setRoot(loader.load());
stage.setScene(scene);
stage.show();
} catch (IOException e) {
e.printStackTrace();
}
代码示例来源:origin: org.controlsfx/controlsfx
public static void stripRootPane(Scene scene, Parent originalParent, boolean useReflection) {
Parent oldParent = scene.getRoot();
getChildren(oldParent, useReflection).remove(originalParent);
originalParent.getStyleClass().remove("root"); //$NON-NLS-1$
scene.setRoot(originalParent);
}
代码示例来源:origin: stackoverflow.com
Stage stage = new Stage();
Scene scene = new Scene();
scene.setRoot(new AnchorPane(...));
stage.setScene(scene);
代码示例来源:origin: org.controlsfx/controlsfx
public static void injectAsRootPane(Scene scene, Parent injectedParent, boolean useReflection) {
Parent originalParent = scene.getRoot();
scene.setRoot(injectedParent);
if (originalParent != null) {
getChildren(injectedParent, useReflection).add(0, originalParent);
// copy in layout properties, etc, so that the dialogStack displays
// properly in (hopefully) whatever layout the owner node is in
injectedParent.getProperties().putAll(originalParent.getProperties());
}
}
代码示例来源:origin: stackoverflow.com
@Override public void start(Stage stage) {
Scene scene = new Scene(new Group());
scene.setRoot(new BuildLayout(stage));
Screen screen = Screen.getPrimary();
Rectangle2D bounds = screen.getVisualBounds();
stage.setTitle("Application Name");
stage.setScene(scene);
stage.setX(bounds.getMinX());
stage.setY(bounds.getMinY());
stage.setWidth(bounds.getWidth());
stage.setHeight(bounds.getHeight());
stage.show();
}
代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.text.ui
public TextViewerHoverManager(TextViewer textViewer) {
this.textViewer = textViewer;
this.popup = new PopupWindow() {
};
this.popup.setAutoFix(false);
this.popup.setAutoHide(false);
this.textViewer.getTextWidget().sceneProperty().addListener( e -> {
if( textViewer.getTextWidget().getScene() != null ) {
popup.getScene().getStylesheets().setAll(textViewer.getTextWidget().getScene().getStylesheets());
}
});
root = new BorderPane();
root.getStyleClass().add("styled-text-hover");
popup.getScene().setRoot(root);
}
代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls
public DragFeedbackPopup(Node n) {
this.n = n;
this.popupWindow = new PopupWindow() {
// Empty
};
this.popupWindow.setAutoFix(false);
this.popupWindow.setUserData("findNodeExclude"); //$NON-NLS-1$
// this.stage.setAlwaysOnTop(true);
StackPane root = new StackPane();
root.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));
// Scene value = new Scene(root);
// value.setFill(Color.TRANSPARENT);
// this.stage.setScene(value);
this.popupWindow.getScene().getStylesheets().setAll(n.getScene().getStylesheets());
this.popupWindow.getScene().setRoot(root);
}
代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.ui.controls
public DragFeedbackPopup(Node n) {
this.n = n;
this.popupWindow = new PopupWindow() {
// Empty
};
this.popupWindow.setAutoFix(false);
this.popupWindow.setUserData("findNodeExclude"); //$NON-NLS-1$
// this.stage.setAlwaysOnTop(true);
StackPane root = new StackPane();
root.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));
// Scene value = new Scene(root);
// value.setFill(Color.TRANSPARENT);
// this.stage.setScene(value);
this.popupWindow.getScene().getStylesheets().setAll(n.getScene().getStylesheets());
this.popupWindow.getScene().setRoot(root);
}
代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls
public DragFeedbackStage(Node n) {
this.n = n;
this.popupWindow = new Stage();
this.popupWindow.initStyle(StageStyle.TRANSPARENT);
// this.popupWindow.initOwner(n.getScene().getWindow());
this.popupWindow.setUserData("findNodeExclude"); //$NON-NLS-1$
this.popupWindow.setAlwaysOnTop(true);
StackPane root = new StackPane();
root.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));
Scene value = new Scene(root);
value.setFill(Color.TRANSPARENT);
this.popupWindow.setScene(value);
this.popupWindow.getScene().getStylesheets().setAll(n.getScene().getStylesheets());
this.popupWindow.getScene().setRoot(root);
}
代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.ui.controls
public DragFeedbackStage(Node n) {
this.n = n;
this.popupWindow = new Stage();
this.popupWindow.initStyle(StageStyle.TRANSPARENT);
// this.popupWindow.initOwner(n.getScene().getWindow());
this.popupWindow.setUserData("findNodeExclude"); //$NON-NLS-1$
this.popupWindow.setAlwaysOnTop(true);
StackPane root = new StackPane();
root.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));
Scene value = new Scene(root);
value.setFill(Color.TRANSPARENT);
this.popupWindow.setScene(value);
this.popupWindow.getScene().getStylesheets().setAll(n.getScene().getStylesheets());
this.popupWindow.getScene().setRoot(root);
}
内容来源于网络,如有侵权,请联系作者删除!