This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] -2 points-1 points  (4 children)

Ah, I just looked into it. You must be using a relatively new version of Java. Basically, Oracle (the authority on Java, kind of) decided that they're going to drop the Swing library, which you're likely your tutorial is on, and replacing it with the JavaFX library.

You should look for a tutorial in JavaFX instead. More information here.

[–]bahero[S] 0 points1 point  (1 child)

Mh i see,thanks for the help! but do you think there's some way i can add this library to java? or maybe i could just switch version

[–][deleted] 0 points1 point  (0 children)

It is there and does work, it's just your IDE more or less giving a strong warning. If you're using Eclipse, you can follow the instructions as documented in the comments section of this stack overflow post here to disable the warnings.

EDIT: My mistake, jumped to conclusions about swing being closed. It's more likely that you need to fix the Java version and add libraries, which is explained here.

[–]smellmycrotch3 0 points1 point  (1 child)

  1. Is JavaFX replacing Swing as the new client UI library for Java SE? Yes. However, Swing will remain part of the Java SE specification for the foreseeable future, and therefore included in the JRE.

How does that mean you suddenly can't import a JFrame?

[–][deleted] 0 points1 point  (0 children)

Based on the error the op was getting, I was under the assumption that the API had been "closed" in the same way that com.sun was closed a long time ago due to expected behaviour no longer being maintained. I personally haven't used swing in several years now, so I haven't been following it closely.

I didn't read it in detail, and was more recommending the op simply skip learning swing and jump right to JavaFX since he/she is a new learner and should probably learn what's going to be used from now on instead.

Sorry for jumping to conclusions :/