• Post Reply Bookmark Topic Watch Topic
  • New Topic

GridPane setPadding(); error  RSS feed

 
Christian Antfeld
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The grid.setPadding method is giving me an error in my program saying that java.awt insets can not be converted to javafx.geometry insets.  I have changed the geometry import to include all of the geometry package by using the .* after geometry but nothing has changed.

I must be missing something.  I am following the Oracle tutorial exactly as it is written but this error persists and causes a compiler error.
 
Randy Maddocks
Ranch Hand
Posts: 184
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Christian,

One thing I have learned about imports is you have to be careful not to presume importing "broad-based" packages covers all classes (using wildcards), specifically the one you need.

Try importing javafx.geometry.Insets specifically instead of javafx.geometry.*, which I presume you were trying to do.

Hope this helps. If it does, credit goes to the responder on this forum

Regards,

Randy
 
Christian Antfeld
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe I have tried that already but I will try it once again later when I get home from work.  If no response, it didn't work.  Thanks for the info though.  I didn't know that wasn't a catch-all for instances like that.
 
Randy Maddocks
Ranch Hand
Posts: 184
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are welcome.

My comment concerning wildcards in import statements aside, without seeing all the import statements you are using, but based on the error you indicated, the compiler is looking for the specific javafx.geometry.Insets package. If you have java.awt.Insets then that is not the one the compiler needs.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!