• Post Reply Bookmark Topic Watch Topic
  • New Topic

JLabel HTTP form

 
jandries Aldum
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to know if its possible to put a form inside a JLabel using http,

I used the following code:



The label displays the button correctly, and I can click on the button, but, when I click on the button, it throws an exception
because the program tries to cast the JLabel to a javax.swing.JEditorPane

Any ideas? or maybe another way I can use HTML like this?
i know I can use regular buttons, i just want to know if this is possible, because why can you access the form in a JLabel if it doesnt work?
 
Rob Spoor
Sheriff
Posts: 20820
68
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think this is what Sun had in mind when they enabled HTML for component labels. This HTML should only contain layout specific HTML code, not things like JavaScript, input controls and forms.

If you need to submit to Google, use a proper JButton with an Action / ActionListener, and use a library like HttpClient for the actual request. Use a SwingWorker to avoid your GUI to hang while performing the HTTP request.
 
jandries Aldum
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alright.. just wanted to know how advanced you can go http wise in a JLabel...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!