Why is it that JEditorPane cannot display some of the HTML controls other than text? How can I display buttons and other controls?

Sandip Chitale

The JEditorPane is not a full blown implementation of HTML browser. It does not support an HTTP forms interface. However you can add components like JButton to the JEditorPane using the following method -



SimpleAttributeSet sas = new SimpleAttributeSet();

StyleConstants.setComponent(sas, new JButton("Hello"));

editorPane.getDocument().insertString(
editorPane.getDocument().getLength(), "", sas);

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact