This discussion is archived
0 Replies Latest reply: Jan 3, 2013 7:26 AM by 982737 RSS

ComboxBox , ChoiceBox and TabPane popups display in the incorrect position

982737 Newbie
Currently Being Moderated
When I display the popup for a ComboxBox , ChoiceBox or TabPane it comes out free floading away from the button it should go underneath. Am I missing something fundamental, is this broken, or is there any work around to make it work? Is JavaFX used much within a Swing Appllet in a browser?

The problem occurs with JavaFX within Swing in an applet in a browser, IE or FF, Windows XP or 7, JRE 7u10 (JavaFX 2.2.4). (Also u9)

I can repeat something similar to what happens in my full code by creating a new 'JavaFX in Swing Application' project in NetBeans and then replacing the hello world button with the example code for ComboBox from the JavaFX tutorials. That results in this code:
 
     private void createScene() {
          ObservableList<String> options =
               FXCollections.observableArrayList(
                    "Option 1",
                    "Option 2",
                    "Option 3"
               );
          final ComboBox comboBox = new ComboBox(options);

          StackPane root = new StackPane();
          root.getChildren().add(comboBox);
          fxContainer.setScene(new Scene(root));
     }
(The framework generated by NetBeans does run the above form Platform.runLater.)

If I select 'in browser' and launch it, the popup originally comes up under the button. If I move the browser across the screen and repeat, the popup comes up at its old position. Similarly if the browser window is small enough so the ComboBox is off the bottom and you have to scroll down to see it, the popup appears at the location that would be correct if the browser window was big enough to show it without scrolling.

(My original code adds the ComboBox in a panel withing the applet after it is originally displayed. Then without any scrolling or moving of the browser window the popup comes up half way down the left hand side of the screen outside the browser window. I think the above simpler code is a variation of the same symptoms.)

The problem does not seem to occur if I run the same code 'Standalone' or 'as WebStart', only in a browser. Unfortunately the software I am trying to convert from Swing to JafaFX runs as an applet in a browser.

I have tried adding code to OnShowing/OnShown callbacks to force a new layout or remove and re-add the ComboBox with no effect. I can't see any way to reference the popup from the code. Any ideas appreciated.

(I saw there is an older thread relating to previous software 'Choice and Combox box popup displays in the incorrect position' last updated 13-Feb-2012 with no resolution or further updates after two days.)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points