• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

ObservableArrayList, and Arraylist<Abstract BaseClass> -> SubClass1, SubClass2  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I am new to JavaFX. I have some MVC experience with Django and Laravel.  I have looked at the documentation for JavaFX and I am a bit confused.
Omitting code for now (as I only have a few minutes to type this up.)


I have an  Abstract BaseClass, and two subclasses that extend it. Say SubClass1 and SubClass two.

I have an ObservableArrayList that displays the two subclasses from an ArrayList of BaseClass.

I would like to know how to modify an existing object in the ObservableArrayList and change it from BaseClass1 to BassClass2.

Do you have any suggestion on how to do this?

Thanks for your time.
If you need a code example I can post it later. I have no time to do that at the moment.
 
Marshal
Posts: 24473
55
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch, Brian!

Those are kind of vague names for your classes, but anyway... You can't change an object of class One to be an object of class Two.

Perhaps you could do something else which satisfies your needs, but you haven't said what they are. It looks like you have hit one of the common forum traps: "I need to do X, but I don't know how. But wait! If I could do Y then I will be able to do X. So I will ask how to do Y." It often turns out that there's a way to do X which doesn't involve Y at all.

And is this really a JavaFX problem? If it's really JavaFX then it would help if you described how it's related to JavaFX. If it's a general Java question, then just let us know and one of the moderators can move the thread into a better forum.
 
For my next feat, I will require a volunteer from the audience! Perhaps this tiny ad?
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!