Use of Swing in Java EE

Asked

Viewed 162 times

1

Good Afternoon, when the programmer works with Java WEB, he generates graphical interface using the javax.swing class as in Desktop?

  • 1

    As far as I know, swing is just desktop, for web there is the JAVA FX.

  • Thank you Diego..

1 answer

1


TL;DR

Not, when speaking in Java Web, especially in Java EE, interfaces are built using HTML, CSS and Javascript.

But this is not the whole story...

Java Applets

It is actually possible to some degree use Swing on a web page using Java Applets, which are Java programs that run on the user’s machine within the browser, and can use Swing components.

It’s like having a desktop window inside your browser.

However, Java Applets is a outdated technology that no one recommends using anymore, including Chrome stopped supporting a few months ago. The main problems are related to security and also to the fact that this completely escapes the concept of a web system.

Java Network Launch Protocol (JNPL)

Another technology that attempts to facilitate the use of Java Desktop applications is JNPL, which allows a desktop application, possibly based on Swing, to be downloaded and run by the user automatically, without the need for installation or configuration.

It is not uncommon for web systems to bridge to a JNDI application, that is, you log into the web system and then you are redirected to a JNPL descriptor that then loads desktop system into your local JVM.

Quasi-swing #sqn

To take advantage of the familiarity that many developers have with Swing, some solutions for Java Web try to take advantage of the same concept of componentization, as is the case of Vaadin, Wicket, GWT or even JSF, although the latter is today a little closer to HTML than the others.

Basically they use some template or even API that allows you to build and manipulate components via code, however these components are implemented with HTML, CSS and Javascript.

It is claimed that such use of the components increases productivity, as the developer does not need to worry about the design. However, such frameworks have been known to present several difficulties to extend components or browser compatibility, often causing the developer to have to dig into scripts and tags at some point.

  • Thank you for the Comment , Clarified My Doubt..

Browser other questions tagged

You are not signed in. Login or sign up in order to post.