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

Shifted combo pop-up when embedded in SWT

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 7u9
    • Fix Version/s: 8
    • Component/s: javafx
    • Labels:
    • Environment:

      SWT 3740, Java 1.7.0_09

      Description

      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();
         }

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: