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

Shifted combo pop-up when embedded in SWT

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • 7u9
    • javafx
    • SWT 3740, Java 1.7.0_09

      When embedding an FXCanvas directly in an SWT group without an SWT canvas in between Combobox pop-ups inside the FXCanvase are shifted some pixels to bottom right.
      The following widget hierarchy leads to the Problem:

      SWT shell -> SWT group -> FXCanvas -> GridPane -> ComboBox

      Putting an SWT canvas between group and FXCanvas solves the problem as well as removing the SWT group. See test method below.

       private void openTestShell(final boolean useSwtGroup,
               final boolean useSwtCanvas) {
            Shell shell = new Shell(display);
            shell.setLayout(new FillLayout());
            Composite parent = shell;
            if (useSwtGroup) {
               Group group = new Group(parent, SWT.NONE);
               group.setLayout(new GridLayout(1, true));
               parent = group;
            }
            if (useSwtCanvas) {
               Canvas swtCanvas = new Canvas(parent, SWT.NONE);
               swtCanvas.setLayout(new FillLayout());
               parent = swtCanvas;
            }

            FXCanvas canvas = new FXCanvas(parent, SWT.NONE);

            GridPane gridPane = new GridPane();
            Scene scene;
            scene = new Scene(gridPane);
            canvas.setScene(scene);
            ComboBox<String> myCombo = new ComboBox<String>();
            myCombo
                  .setItems(FXCollections.observableArrayList("One", "Two", "Three"));
            gridPane.add(myCombo, 0, 0);
            shell.pack();
            shell.open();
         }

            snorthov Steve Northover (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: