Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlets to Swing

 
Mohan Panigrahi
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a small Servlets application, with three pages. It stores and displayes data from xml files. This requires some application server to run. Now I wish to transfer it to swing, so that I can distribute it to my friends. My requirement is that I should be able to retain the HTML look as I have already developed for the servlets application.
Any suggestions or some code snippets on how to go about it, would be helpful.
Thanks
Mohan
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
if you have a html/web application up and running - why would you want a swing application?
however, a swing client can connect to a servlet. so you shouldn't have to implement some new backend.
here is some sample code for calling a method from the client on the servlet:

regards,
Chantal
 
Mohan Panigrahi
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply.
To clarify : I want to port it to swing, because I want to distribute it without having to host the application in some app server.
All suggestions welcome!
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is your servlet doing actually? won't you need it for the swing client?
 
Mohan Panigrahi
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok!
My servlet throws a page which shows all the tasks a person has to do. He has button to add more tasks or remove the already present tasks.
The html page has colorful buttons, style sheets etc.
What I want to do is to give the user, an installable by which he can the program run on his own machine. But I still need to retain the looks of html.
I hope you would understand my requirements
 
Younes Essouabni
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In fact you may create a JTextArea that will behave just like a web browser. I think that's what you need, but don't ask me how to do it
I hope it helps
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a JTextArea can't behave like a Browser. a JEditorPane can render html, but it cannot replace a browser (there are commercial java browser components, though).
I think, you should write the swing client first, with all the behaviour that has the browser application. that is still some task to do. afterwards you can think about the look and feel of the client. With the pluggable LookAndFeel of swing it is no problem to change the appearance of your application according to some config settings. how to create a LookAndFeel, or how to implement at least a Theme, see the source code of the classes in javax.swing.plaf.metal.*.
sun has published a detailed tutorial on LookAndFeel on the net.
chantal
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic