Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A better way to do Swing Applications

Tags:

java

swing

javafx

Is there a better way to develop Java Swing applications?

SWIXML? JavaFX? Anything else that developers out here have liked and recommend?

like image 977
tellme Avatar asked Dec 04 '08 09:12

tellme


People also ask

What are the application of Swing?

Swing in java is part of Java foundation class which is lightweight and platform independent. It is used for creating window based applications. It includes components like button, scroll bar, text field etc. Putting together all these components makes a graphical user interface.

Which is better JavaFX or Swing?

In short, Swing and JavaFX are both GUI toolkits for Java programs. Swing is the old standard toolkit that features a bigger library of GUI elements and mature IDE support. JavaFX is the newer standard with a smaller library, more consistent updates, and consistent MVC support.

Is Java Swing still relevant?

Swing and AWT will continue to be supported on Java SE 8 through at least March 2025, and on Java SE 11 (18.9 LTS) through at least September 2026.


1 Answers

Another "better way" is through the use of a better Layout Manager:

MigLayout:
an extremely flexible and easy to use Layout Manager that works for both Swing and SWT.
It can do what Table Layout, Form Layout and almost all Swing Layout Managers can with simple to understand String and/or API based coding.
It is targeted to be for manually coded layouts what Matisse/Group Layout is for IDEs.

JPanel panel = new JPanel(new MigLayout());

panel.add(firstNameLabel);
panel.add(firstNameTextField);
panel.add(lastNameLabel,       "gap unrelated");
panel.add(lastNameTextField,   "wrap");
panel.add(addressLabel);
panel.add(addressTextField,    "span, grow");

alt text
(source: miglayout.com)

like image 136
VonC Avatar answered Sep 26 '22 12:09

VonC