compare vaadin and swing

Hi all
i have developed vaadin,and i see way to program,component vaadin similar swing, what is different betwen them?
thank all

A Swing app executes on the user’s computer. A Vaadin app executes on the server computer.

A Swing app renders itself directly on screen, in control of its own windows and menu bar, similar to a native app. A Vaadin app is rendered inside a web browser.

A Swing app requires an implementation of Java be installed on the user’s machine. A Vaadin app runs on virtually any computer with a modern web browser.

A Swing app can have either a native look-and-feel or a cross-platform look-and-feel. A Vaadin app has one of a few non-native look-and-feels provided by Vaadin “themes”.

A Swing app needing a database exposes the connection over untrusted networks or the internets requiring you to take extra steps. A Vaadin app running on the server-side can connect to a database on its own machine or via a more-easily protected connection.

Both Swing and Vaadin apps are bulit using the Observer pattern. User actions generate events to which you respond by implementing listener methods.

Both Swing and Vaadin toolsets have a rich collection of widgets (fields, buttons, etc.). Both allow you to build your own widgets or extend the existing ones.

A Swing app can integrate more closely with the host plaform. A Vaadin app runs within the security and practical limitations of a web browser.

A Swing app can be made to call native code on the user’s machine, through
JNI
. A Vaadin app is isolated from the user’s host platform by the web browser.

A Swing app can run offline, running locally on the user’s machine. A Vaadin app runs only while online with a web server.

Both Swing and Vaadin are commonly used to create interactive business-style apps.

To add to Basil’s excellent answer I’d like to highlight in Swing there is a heavy emphasis on component painting. In Swing all components can override their own painting through the paint() method which they inherit from the JComponent class. This made it very easy for Swing developers to add decorations or visual customizations to the components in the Java application, whereas in Vaadin such customization happens at the Web Component (previously GWT) level. Swing developers could easily change the default look and feel of their components and make them dependent on runtime conditions that could exist at the application layer. This logic could get quite sophisticated as each Swing component was in essence its own miniature 2D graphics canvas and you were able to draw lines and 2D shapes using arbitrary coordinate offsets from the Swing component’s origin.

Fortunately the capability of Swing far exceeds the needs of a typical business application. But if 2D graphics is a core feature of your Swing application, you will still benefit from Vaadin, but consider SVG, the HTML5 Canvas element, or the WebGL API as alternatives for what you previously did with the paint() method.

Another thing to note that with Vaadin, many kinds of add-on components can be implemented with JavaScript. So if an existing JavaScript component exists somewhere on the internet, you can include it in your Vaadin application by creating a JavaScriptExtension.