• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using swing in Java

 
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know Swing provides good GUI capability. Now, with web applications we use JSP or Servlets(again like JSP). How do we use swing here when we going to run web application using http. Most examples in books i have seen are using applet or stand alone application. That is not a normal case. What kind of set up we need in architecture to use swing.
 
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't use Swing in a standard web app. Embedding applets are the only way to get Swing in a web browser. You can distribute stand-alone apps over the web with jnlp.

The end result of a web application is an HTML page displayed in a browser. Java is one way to provide dynamic content in the form of generated HTML documents delivered through a servlet container (like Tomcat).

You may want to look at some web frameworks such as Tapestry (My personal favorite), Spring MVC, Struts, JSF (not sure if JSF really qualifies as a framework though).

In the end it's all HTML and/or some script (usually javascript).

Although I would reject the idea that a stand-alone Java app is not the 'normal case'.
 
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Steven,
So what would you suggest best for making colorful webpages.So,should we use just JSP,Servlets,HTML,Applets and Java Script.Would that serve the purpose??Can we make a full-functional website without using swing.I am thinking to make a website,but i am not quite sure where to start with.I need the drop-down boxes,dynamic images,login etc functionalities.Can i avoid swing and get all these funtionalities into my website.Please tell me the simplest way..thanks.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just to be clear: no websites use Swing. Swing-based applets on the Web are exceedingly rare, and those few that exist are tech demos or toys of some kind. No websites use applets as their primary mode of interaction.

Swing is for desktop apps; JSP (i.e., HTML) is for web apps.
 
Jas Oberai
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ernest,
But just a small element of doubt still exists......if for instance,I use JSP to generate web-pages,I won't have lay-out manager sort of functionalities,so dont you think that it would be a little difficult to handle with simple HTML tables.And where from would we get the drop-down menus,checkboxes....do you think html should be used to generate all of them in combination with java script.
Thanks
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You'd be surprised what you can do with HTML (for expressing the content) and CSS (for doing the formatting and layout.) Remember that every web site you visit is working with these same basic tools.

JavaScript adds some behavior, but it can't do anything to the appearance of a site that you can't do without it just as easily.
 
Raj Puri
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, coming from client/server systems where we could do two very powerful things in Powerbuilder/Oracle forms world - create Tab pages and create tree navigators. These two give a very clean look to application and let some one look application more matching business needs. Seems from this thread there is no way I can do this with JSP as these are really not supported by HTML - may be tons of code of Javascript etc will do. We have applications that has a number of menu/sub-menus and tab pages for each submenu. Really, only way is to go for ASP.NET and forget Java - but I have concers with some special outerHTML that Microsoft uses that will fail on Mac, Firefox etc.
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ernest Friedman-Hill:
No websites use applets as their primary mode of interaction.

Are you sure about that? I support a web site built around applets. Also, I am fairly certain that at least one on-line brokerage uses Swing to enable all sorts of functionality to traders. In fact, my brother in laws firm writes support applications for traders and brokers using Swing over the web. So, swing and applets may be rare but I wouldn't say that there are no websites using them.
 
Thomas Paul
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Raj Puri:
We have applications that has a number of menu/sub-menus and tab pages for each submenu.

You mean like this: http://www.symbol.com/
 
Raj Puri
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, not like that. I am talking of two controls. Navigator conrol - it has like file explorer and tab pages(there could be nested tab pages). These can not be implemented using JSP/HTML etc, I believe tab page can be done with swing. But doing w/o applet constraints design. Applets are not allowed because of security concerns at most classified govt projects.
 
Ranch Hand
Posts: 375
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Raj Puri:
I know Swing provides good GUI capability. Now, with web applications we use JSP or Servlets(again like JSP). How do we use swing here when we going to run web application using http.



If you wrote a good API to handle all the business logic, which was generic enough to "port" over to any context, then moving it from say, a web application to a command-line interface or GUI should not be a problem. If you find that you need to change a lot of code (not the presentation-layer), then its probably a bad design.

Are you trying to port a web application to a GUI or vice-versa? HTTP browsers are very basic, they are HTML viewers with some addon's. If you want more control over what the user sees, with rich widgets, than using a GUI library such as Swing or SWT/JFace would be the way to go. If you use the MVC pattern, then changing the "View" should not be a problem at all.

Originally posted by Raj Puri:
Applets are not allowed because of security concerns at most classified govt projects.



If you sign the applet, you can bypass the security and the applet can do I/O on the local machine. I don't know what you mean by "classified govt projects".
[ May 14, 2005: Message edited by: Kashif Riaz ]
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Thomas Paul:
So, swing and applets may be rare but I wouldn't say that there are no websites using them.



I stand corrected, I guess. Maybe I should qualify what I said to "no general-purpose consumer Internet sites." Intranets use them, certainly, as would sites that deliver rich functionality to motivated customers. But what I was saying in general was that any consumer website that wants to capture Joe Sixpack's attention commits customer-service suicide by requiring the Java plug-in.
 
Steven Bell
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Raj Puri:
No, not like that. I am talking of two controls. Navigator conrol - it has like file explorer and tab pages(there could be nested tab pages). These can not be implemented using JSP/HTML etc,


I would be careful saying that. The project I'm working on has tabbed 'panes' and expandable/collapsable trees all done in html and javascript (java servlets on the backend).


I believe tab page can be done with swing. But doing w/o applet constraints design. Applets are not allowed because of security concerns at most classified govt projects.



It sounds to me that you don't know just how much cool stuff can be done with just html and javascript.

Things like JSP, Tapestry, Struts, SpringMVC, ect... are frameworks that provide easier development than trying to do all that with straight servlets (which in the end generate html and javascript).

Tapestry is my personal favorite framework and here are some links that show a few cool things being done with it. Remeber by the time it gets to the browser it's all just html and javascript.



menus

workbench. An example of many of the standard Tapestry 'widgets'.

Tree component.

Again all this is done in the end with just html and javascript. It's much more capable than what you seem to think.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic