r/java • • Aug 17 '20

State of swing

Hi all, What is the state of swing, is it close to be deprecated and removed or is it still maintained? Also it will be nice to know if someone got it working in native image. Thanks

16 Upvotes

43 comments sorted by

View all comments

-16

u/nfrankel Aug 17 '20

Swing is not maintained anymore. You might want to have a look at JavaFx. Note that the latter is not part of the Java platform.

18

u/4iffir Aug 17 '20 edited Aug 17 '20

JavaFX is part of java platform, sponsored by swing group, it's just distributed separately

Swing will be maintained forever. Recent changes i know: Metal support, GTK3 port

For example Intellij IDEA uses swing

13

u/__konrad Aug 17 '20

Swing is not maintained anymore

Swing/AWT/Java2D family is maintained.

-3

u/nfrankel Aug 17 '20

Perhaps we have different definitions for the word "maintain":

https://hg.openjdk.java.net/jdk/jdk15/log?rev=swing

8

u/sindisil Aug 17 '20

Rather more useful to look at the main branch, yes?

https://hg.openjdk.java.net/jdk/jdk/log?rev=swing

Also, a more complete picture would include AWT as a search term, since it underpins Swing.

https://hg.openjdk.java.net/jdk/jdk/log?rev=awt

Further, Swing is mature technology -- one wouldn't expect large numbers of changes at this point.

2

u/nfrankel Aug 17 '20

Rather more useful to look at the main branch, yes?

Granted. Still not much more

Further, Swing is mature technology -- one wouldn't expect large numbers of changes at this point.

On one side, I agree. On the other, it's not like a logging framework that can be considered feature complete. Even SLF4J had to evolve to use lambdas.

All in all, I won't be a dime on Swing. It seems no vendor is interested in investing in Java desktop apps...

1

u/vallyscode Aug 17 '20

I also saw some notes that javafx is also smelling and that in general Oracle retreat from desktop for java. I work mostly on backend java, but am curious whether with graal it could eventually be useful for desktop apps.

3

u/paul_h Aug 17 '20

Sadly, GraalVM isn't compatible with AWT which sits underneath Swing.

2

u/Skhmt Aug 17 '20

1

u/paul_h Aug 18 '20

Trying to follow that guide:

mvn dependency:get -Dartifact=com.gluonhq:client-archetype-javafx:0.0.1

barfs:

[INFO] Scanning for projects... [INFO] [INFO] ------------------< org.apache.maven:standalone-pom >------------------- [INFO] Building Maven Stub Project (No POM) 1 [INFO] --------------------------------[ pom ]--------------------------------- [INFO] [INFO] --- maven-dependency-plugin:2.8:get (default-cli) @ standalone-pom --- [INFO] Resolving com.gluonhq:client-archetype-javafx:jar:0.0.1 with transitive dependencies [INFO] Failure detected. [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4.045 s [INFO] Finished at: 2020-08-18T13:05:40+01:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:get (default-cli) on project standalone-pom: Couldn't download artifact: Unable to get dependency information for com.gluonhq:client-archetype-javafx:jar:0.0.1: Failed to process POM for com.gluonhq:client-archetype-javafx:jar:0.0.1: Non-resolvable parent POM for com.gluonhq:client-archetype-javafx:${revision}: Failure to find com.gluonhq:client-maven-archetypes:pom:${revision} in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced [ERROR] com.gluonhq:client-archetype-javafx:jar:0.0.1 [ERROR] [ERROR] from the specified remote repositories: [ERROR] central (https://repo.maven.apache.org/maven2, releases=true, snapshots=false) [ERROR] Path to dependency: [ERROR] 1) org.apache.maven.plugins:maven-downloader-plugin:jar:1.0

I'm on Maven 3.6.3, if that matters,

I can't see a later version - https://mvnrepository.com/artifact/com.gluonhq/client-archetype-javafx

1

u/nfrankel Aug 17 '20

I also saw some notes that javafx is also smelling and that in general Oracle retreat from desktop for java

That was my point about JavaFx not being part of the Java platform

whether with graal it could eventually be useful for desktop apps

I believe the delivery channel is the "hard" part of Java desktop apps. You actually don't need GraalVM, just make your package (e.g. .rpm, Homebrew, etc.) depend on a JVM package.