java.lang.NullPointerException at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:1129)

Pavel Safrata pavel.safrata at oracle.com
Tue Jul 23 03:51:34 PDT 2013


Hi Peter,
it's enough to report on one place, let's discuss the issue in the bug. 
I'll put there a comment soon.
Pavel

On 23.7.2013 12:37, Peter Penzov wrote:
> Hi,
>    I'm working on JavaFX example which uses Toggle button:
>
> private void initMainStage(final Stage mainStage)
>      {
>          // Set Main Window Label
>
>          // Set Icon of the main stage
>          Image img = new
> Image(getClass().getResource("/com/dx57dc/images/internet-icon.png").toExternalForm());
>
>          mainStage.getIcons().add(img);
>
>          // Main Stage
>          root = new BorderPane();
>          final VBox vbox = new VBox();
>          // Set Style
>          String pillButtonCss =
> DX57DC.class.getResource("/com/dx57dc/css/PillButton.css").toExternalForm();
>
>
>          // Create 3 toggle buttons and a toogle group for them
>          ToggleButton tb1 = new ToggleButton("Infrastructure");
>          tb1.setId("pill-left");
>          ToggleButton tb2 = new ToggleButton("Agents");
>          tb2.setId("pill-center");
>          ToggleButton tb3 = new ToggleButton("Live Performance");
>          tb3.setId("pill-right");
>
>          final ToggleGroup group = new ToggleGroup();
>          tb1.setToggleGroup(group);
>          tb2.setToggleGroup(group);
>          tb3.setToggleGroup(group);
>          // Select the first button by default
>          group.selectToggle(tb1);
>
>          // Some test data
>          final Rectangle rect2 = new Rectangle(300, 300);
>          rect2.setFill(Color.SILVER);
>          final Rectangle rect3 = new Rectangle(300, 300);
>          rect3.setFill(Color.DODGERBLUE);
>
>          tb1.setUserData(root);
>          tb2.setUserData(rect2);
>          tb3.setUserData(rect3);
>          final HBox hBox = new HBox();
>
>          // Listener which changes toggle buttons content
>          group.selectedToggleProperty().addListener(new
> ChangeListener<Toggle>()
>          {
>              @Override
>              public void changed(ObservableValue<? extends Toggle> ov,
> Toggle toggle, Toggle new_toggle)
>              {
>                  if (new_toggle == null)
>                  {
>                  }
>                  else
>                  {
>                      vbox.getChildren().set(2, (Node)
> group.getSelectedToggle().getUserData());
>                  }
>              }
>          });
>
>          hBox.getChildren().addAll(tb1, tb2, tb3);
>          hBox.setPadding(new Insets(5, 5, 5, 5)); // Padding between the
> main menu and the content
>          hBox.getStylesheets().add(pillButtonCss); // Add the css style
>
>          // Content of the main stage
>          leftHBox = getLeftHBox(mainStage, root);
>          rightHBox = getRightHBox(mainStage);
>          footerVBox = getFooter(mainStage);
>          centerPane = getCenterPane(mainStage);
>
>          // default resizer with drag insets(5,5,5,5);
>          //RegionResizerFX.register(leftHBox, rightHBox, footerVBox,
> centerPane);
>
>          root.setRight(rightHBox);
>          root.setBottom(footerVBox);
>          root.setLeft(leftHBox);
>          root.setCenter(centerPane);
>
>          RegionResizerFX.register(centerPane);
>
>          // Vbox which holds main menu, toggle buttons and main content
>          vbox.getChildren().addAll(getMenu(mainStage, root), hBox, (Node)
> group.getSelectedToggle().getUserData());
>
>          // Set main stage size and color
>          Scene scene = new Scene(vbox, 1200, 650, Color.WHITESMOKE); // Set
> main Stage color
>
>          // Application Close Confirmation Dialog
>          dialog = new DialogPanels();
>          dialog.initClosemainAppDialog(mainStage);
>
>          // Application Hot Keys Utilization
>          hotkey = new HotKey();
>          hotkey.initApplicationHotKeys(mainStage, scene);
>
>          mainStage.setScene(scene);
>
>          Rectangle2D primaryScreenBounds =
> Screen.getPrimary().getVisualBounds();
>
>          // Set Stage boundaries to visible bounds of the main screen
>          mainStage.setX(primaryScreenBounds.getMinX());
>          mainStage.setY(primaryScreenBounds.getMinY());
>          mainStage.setWidth(primaryScreenBounds.getWidth()); // Maximum
> width of the display
>          mainStage.setHeight(primaryScreenBounds.getHeight()); // Maximum
> height of the display
>          //mainStage.show();
>
>      }
>
>
> I tried to run the code on JVM 8b99 but I get error which I described here:
>
> https://javafx-jira.kenai.com/browse/RT-31859
>
> Is this JVM bug or I have a bug into my code?



More information about the openjfx-dev mailing list