• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 193
14
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are those exceptions in your code?
 
Simon Ritchie
Ranch Hand
Posts: 193
14
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Im student in Near East University at Programming.And your site is really awesome
https://neu.edu.tr
reply
    Bookmark Topic Watch Topic
  • New Topic