Why does the IDE recognize some imports and not others?

Hello,

I have the following problem. I'm importing the following (among other things) into my class:

import javafx.scene.input.KeyEvent;
import javafx.scene.input.KeyCode;
And now my IDE tells me that KeyEvent works without issues, but KeyCode doesn't. It just can't find it. The strange thing is: When I run my code, KeyCode works, no errors appear, and the functionality works as intended – it just displays an error in the IDE.
Maybe someone has an idea that would be great, thanks.

1 vote, average: 1.00 out of 1 (1 rating, 1 votes, rated)
You need to be a registered member to rate this.
Loading...
Subscribe
Notify of
20 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
derITprofi
9 months ago

Sounds like an indexing problem or the project settings in IntelliJ

derITprofi
9 months ago
Reply to  timmyfck2

Of course, it's strange that only a part of it works, but there are many steps you could do to fix it.
Inconsistent indexing, caching problems, partial library integration, class loader problem, IDE bending of only certain classes.
Try manual reloading of the class, check the module dependencies, importer = import javafx.scene.input.KeyCode;
Clean and Rebuild and finally check the .iml file if there is and see if all JavaFX related entries are correct.

Tux20240301
9 months ago

Which IDE do you use?

guterfrager5
9 months ago
Reply to  timmyfck2

If you want to shoot yourself in your leg, you can try it with Eclipse … is probably the worst IDE but with me the most worked 😄

Tux20240301
9 months ago
Reply to  timmyfck2

Are methods of the class concerned used in the source code itself?

guterfrager5
9 months ago
Reply to  Tux20240301

InteliJ IDEA (stands in tags)

Tux20240301
9 months ago

OK.

Tux20240301
9 months ago

Did you restart the IDE?

Tux20240301
9 months ago

Is the import in question also in dependence?

Tux20240301
9 months ago

And this mistake arises in the import directives? Are the IDE known the paths to the modules?

Tux20240301
9 months ago

What is the IDE error message?