Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8117353

Strange rendering bug

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P4
    • fx2.1
    • fx2.0.1
    • javafx

    Description

      Hi,

      I experience a strange rendering bug. I tested on 2 machines, with the same behavior. I doubt it is my graphics driver, because I recently updated. Please execute the code below and see if you experience it too.
      Move the mouse over the UI. Many of the controls on the left side are not displayed sometimes, while moving.

      Is it a bug in JavaFX? Or is my code broken?


      import javafx.application.Application;
      import javafx.geometry.Insets;
      import javafx.geometry.Orientation;
      import javafx.scene.Scene;
      import javafx.scene.control.*;
      import javafx.scene.layout.GridPane;
      import javafx.scene.layout.HBox;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      public class TestApp3 extends Application {
          public static void main(String[] args) throws Exception {
              launch(args);
          }


          public void start(Stage stage) throws Exception {

              HBox root = new HBox();
              root.setPadding(new Insets(10, 10, 10, 10));

              root.setSpacing(10);

              VBox left = new VBox();
              left.getChildren().add(new UserControl(4));
              left.getChildren().add(new UserControl(2));

              VBox right = new VBox();
              right.getChildren().add(new UserControl(3));

              left.setSpacing(10);
              right.setSpacing(10);

              Separator separator = new Separator();

              separator.setOrientation(Orientation.VERTICAL);

              root.getChildren().add(left);

              root.getChildren().add(right);

              Scene scene = new Scene(root);

              stage.setScene(scene);
              stage.show();
          }

          public class UserControl extends VBox {
              public UserControl(int rows) {
                  super();

                  setSpacing(5);
                  GridPane gridPane = new GridPane();
                  gridPane.setHgap(5);

                  gridPane.add(new ControlContainer("Label", new ChoiceBox()), 0, 0);
                  gridPane.add(new ControlContainer("Label", new TextField()), 1, 0);

                  gridPane.add(new ControlContainer("Label", new TextField()), 0, 1);
                  gridPane.add(new ControlContainer("Label", new TextField()), 1, 1);

                  gridPane.add(new ControlContainer("Label", new TextField()), 1, 2);
                  gridPane.add(new ControlContainer("Label", new TextField()), 0, 2);

                  gridPane.add(new ControlContainer("Label", new ChoiceBox()), 1, 3);
                  gridPane.add(new ControlContainer("Label", new TextField()), 0, 3);

                  Label lblData = new Label("Data");
                  lblData.setStyle("-fx-font-weight:bold;");

                  getChildren().add(lblData);
                  getChildren().add(new Separator());
                  getChildren().add(gridPane);
              }
          }

          class ControlContainer extends VBox {
              public ControlContainer(String label, Control control) {
                  Label lbl = new Label();
                  lbl.setText(label);

                  control.setMinHeight(Control.USE_PREF_SIZE);
                  control.setMaxWidth(Double.MAX_VALUE);

                  getChildren().add(control);
                  getChildren().add(lbl);
              }
          }
      }

      Attachments

        Activity

          People

            jandrese Joe Andresen (Inactive)
            cschudtjfx Christian Schudt (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported: