Display and interact with an HTML form in a Swing application

后端 未结 1 1886
遥遥无期
遥遥无期 2021-01-02 05:13

an application generates some HTML pages that should be displayed in the application itself.

These HTML pages contain some

相关标签:
1条回答
  • 2021-01-02 05:56

    I believe if you have a submit button on your form, it should work and send data to server. I'm not sure if you can interact with it in the code. Those elements are rendered as swing component, so in theory you get all components from the JTextPane and find your button and input fields.

    EDIT To do this is in JEditorPane, you need to set auto for submition property to false

    ((HTMLEditorKit)textPane.getEditorKit()).setAutoFormSubmission(false);
    

    then you will be able to register a hyperlink listener with the editor pane and you will be receiving a FormSubmitEvent. It has url and method, so you can decode some data from it.

    0 讨论(0)
提交回复
热议问题