I have very simple html code (no css, nor js) that includes five inputs with 
type="radio" (in one column) and webview in JavaFX 8 which loads this page.

The problem is the following - sometimes these radios are rendered sometimes 
not.

For example, I start application - webview loads page, however there is empty 
space where these radio must be (these inputs are not rendered,they are not 
seen). But, when I move mouse over the area where these radios must be, they 
appear.

I see this problem in Linux - Centos, Ubuntu and Windows XP. I've not seen this 
problem in Win7.

Here is the code I tested. All the program consists of two classes:

public class JavaFXApplication extends Application {
    private int count=0;
    @Override
    public void start(Stage primaryStage) {
        final Button printButton = new Button("Print");
        final WebView webPage = new WebView();
        final WebEngine webEngine = webPage.getEngine();
        printButton.setOnAction(new EventHandler<ActionEvent>() {
            @Override public void handle(ActionEvent e) {
                String html="<html dir=\"ltr\"><head>\n" +
" <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\n" +
"</head>\n" +
"<body contenteditable=\"true\">\n" +
" \n" +
" \n" +
" \n" +
"\n" +
"\n" +
"<p align=\"justify\" style=\"text-align: left; margin-bottom: 0in; 
line-height: 150%;margin-bottom: 0in; line-height: 100%\">\n" +
"<font style=\"font-size: 14pt\" face=\"serif\">Стали бы Вы на пути\n" +
"грабителя грузового вагона?</font></p><p align=\"justify\" style=\"text-align: 
left; margin-bottom: 0in; line-height: 150%;\"><font style=\"font-size: 14pt\" 
face=\"serif\">Выберите ответ:</font></p>\n" +
"\n" +
"<form name='mainForm' style='margin-top:15px;'>\n" +
"<input type='radio' name='answer' value='641' ><font size='4'>Полностью 
согласен, полное «Да»</font><br>\n" +
"<input type='radio' name='answer' value='642' ><font size='4'>Больше «Да», чем 
«Нет»</font><br>\n" +
"<input type='radio' name='answer' value='643' ><font size='4'>Ни «Да», ни 
«Нет», нечто среднее</font><br>\n" +
"<input type='radio' name='answer' value='644' ><font size='4'>Больше «Нет», 
чем «Да»</font><br>\n" +
"<input type='radio' name='answer' value='645' ><font size='4'>Полное 
«Нет»</font><br>\n" +
"</form><script type=\"text/javascript\">\n" +
"function getAnswerId(){\n" +
" var elements = document.getElementsByName(\"answer\");\n" +
" for (var i=0, len=elements.length; i<len; ++i) {\n" +
" if (elements[i].checked) return elements[i].value;\n" +
" }\n" +
" return null;\n" +
"}\n" +
"</script></body></html>";
                html+=count;
                count++;
                webEngine.loadContent(html);
            }
        });
        HBox hbox = new HBox();
        hbox.getChildren().addAll(printButton);
        BorderPane borderPane = new BorderPane();
        borderPane.setTop(hbox);
        borderPane.setCenter(webPage);
        Scene scene = new Scene(borderPane, 300, 250);
        primaryStage.setTitle("WebView radio bugs");
        primaryStage.setScene(scene);
         primaryStage.show();
    }
} 

And the second class

public class JavaApplication {
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Application.launch(JavaFXApplication.class, args);
    }
}

After that I click Print button. After every clicking count++. Compiled openjdk 
1.8.45. Tested winxp oracle 1.8.40, centos71,ubuntu 12 oracle 1.8.60. The image 
from xp. 29 clicks after that no radios. Moved mouse over 1,3,5: . The result 
is on the image I attached. Please, answer.


-- 
Александр Свиридов

Reply via email to