Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JavaFX GUI - Changing Project System Library To JRE1.8.X Disrupts Swing GUI

 
Simon Ritchie
Ranch Hand
Posts: 96
4
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,

I've written an application in Eclipse that uses a Swing GUI and it's been working fine for some time. I recently read about JavaFX and decided to try building a new GUI for my app using this new technology. So I created a new package in the Project to house the JavaFX implementation of my GUI. TO get this to work I had to change the JRE System Library of my project to 1.8.0_66 (previously it was JDK1.7.0_80).

What's happened is that my JavaFX GUI works fine. But when I try to launch my old Swing GUI I get a large number of ClassCastExceptions:

javax.swing.JButton cannot be cast to javax.swing.JMenuItem
javax.swing.JTextField cannot be cast to javax.swing.JMenuItem
javax.swing.JButton cannot be cast to javax.swing.JMenuItem
javax.swing.JTextField cannot be cast to javax.swing.JMenuItem

I'm not too worried about the impact of this on my project as I have everything backed up and if I get a working JavaFX GUI then I won't need to retain the old Swing classes. But what I want to know is why did upgrading the Java Build Path of the project affect Swing?

Thanks
 
Dave Tolls
Ranch Hand
Posts: 2112
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are those exceptions in your code?
 
Simon Ritchie
Ranch Hand
Posts: 96
4
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, they are. I can post the full stack if you'd prefer but they all seem to involve the JMenu I created for my Swing GUI.
 
Dave Tolls
Ranch Hand
Posts: 2112
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you post the stack trace and the area of your code, or possibly the construction of the JMenu, that causes the issue.
Obviously the stack trace might not involve your code at all.
 
Abuzer Basmac─▒
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im student in Near East University at Programming.And your site is really awesome
https://neu.edu.tr
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic