Created
March 21, 2013 11:21
-
-
Save phdoerfler/5212324 to your computer and use it in GitHub Desktop.
lookup with attached Scene and parent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package bugs; | |
import javafx.application.Application; | |
import javafx.scene.Scene; | |
import javafx.scene.control.ScrollPaneBuilder; | |
import javafx.scene.layout.AnchorPane; | |
import javafx.scene.layout.AnchorPaneBuilder; | |
import javafx.scene.layout.StackPaneBuilder; | |
import javafx.stage.Stage; | |
public class LookupShowJava extends Application { | |
public static void main(String[] args) { | |
launch(args); | |
} | |
@Override | |
public void start(Stage stage) throws Exception { | |
AnchorPane p = AnchorPaneBuilder.create() | |
.children( | |
ScrollPaneBuilder.create() | |
.id("foo") | |
.content( | |
StackPaneBuilder.create() | |
.id("bar") | |
.build()) | |
.build()) | |
.build(); | |
stage.setScene(new Scene(p)); | |
//stage.show(); | |
System.out.println(p.lookup("#foo")); // Prints: ScrollPane[id=foo, styleClass=scroll-pane] | |
System.out.println(p.lookup("#foo").lookup("#bar")); // Prints: null | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uncomment line 30 and the second println will print: StackPane[id=bar]