So similar to how we reffer to objects by their memory addresses, we can reffer to properties of an object (eg. int, string values) with Property. Great tutorial, realy helped me out!
I can imagine Bucky clobbering some babies... But honestly, tutorials with Bucky are a pleasure to watch and god damn, I haven't laughed that much at a programming tutorial in a long time! Keep at it Bucky! And thanks for the video :)
He overcomplicated this part. You can just pass the currently used class as the "this" value.There's no need to create a class and put the Property inside it.
Thanks for the reply. I guess I was thinking of C++. I dont think it is good practice to return reference of private variables through public member functions in C++.
That StringProperty, even if it is private, it is not fully protected because he returns a reference to it within the method firstNameProperty. A copy of that StringProperty would have been suitable but this is not the purpose of this tutorial.
All aforementioned is true, just like to add that returning a private variable via an accessor method, (getter/setter) is one of the main aspects of encapsulation, making variables/data in a class private and only accessible via accessor methods :) 1/5 of the fundamentals of object oriented programming
It's bad practice to expose users of the Person class to the property though, if you want to change the implementation of the listener to something else you would have to rewrite all the client code.
i use netbeans so this is how netbeans takes care of these properties. public class person { private StringProperty name = new SimpleStringProperty(this,"name",""); public String getName() { return name.get(); //.get to actually retrieve the value form this property/ which //now acts as an object } public void setName(String value) { name.set(value);//same way here we use these old and familiar get() and set() } public StringProperty nameProperty() { return name; } } ***makes sence
five years later and still this video explains the concept in an easy understandable and fun way. You're great. Period.
So similar to how we reffer to objects by their memory addresses, we can reffer to properties of an object (eg. int, string values) with Property. Great tutorial, realy helped me out!
I can imagine Bucky clobbering some babies...
But honestly, tutorials with Bucky are a pleasure to watch and god damn, I haven't laughed that much at a programming tutorial in a long time!
Keep at it Bucky! And thanks for the video :)
This tutorial really helped me out. I managed to implement my scene-manager with the properties. Thanks alot! :)
"String is not an object" well... it is an object..
Is this an implementation of the observer pattern ?
04:57 what do you mean when you say "this refers to the object that contains it - this"? I assume the object that contains it is firstName?
He overcomplicated this part. You can just pass the currently used class as the "this" value.There's no need to create a class and put the Property inside it.
06:40 is it okay to have a method that returns a private instance variable?
Thanks for the reply. I guess I was thinking of C++. I dont think it is good practice to return reference of private variables through public member functions in C++.
That StringProperty, even if it is private, it is not fully protected because he returns a reference to it within the method firstNameProperty. A copy of that StringProperty would have been suitable but this is not the purpose of this tutorial.
All aforementioned is true, just like to add that returning a private variable via an accessor method, (getter/setter) is one of the main aspects of encapsulation, making variables/data in a class private and only accessible via accessor methods :) 1/5 of the fundamentals of object oriented programming
It's bad practice to expose users of the Person class to the property though, if you want to change the implementation of the listener to something else you would have to rewrite all the client code.
Great Tutorial! THANKS!
Now, I am wondering if I can use properties to change live from data requested from a RESTful server.
Does this work for more complex datatypes, e.g. java.time.Year?
what's the difference between properties and setOn then add event? i know this video is from 2015 and its 2019 but i want to learn
Why not just change the value through the setter?
Merci
What program are you using Mr. Roberts?
Gene parrott sr IntelliJ Idea from Jetbrains
i use netbeans so this is how netbeans takes care of these properties.
public class person {
private StringProperty name = new SimpleStringProperty(this,"name","");
public String getName() {
return name.get(); //.get to actually retrieve the value form this property/ which //now acts as an object
}
public void setName(String value) {
name.set(value);//same way here we use these old and familiar get() and set()
}
public StringProperty nameProperty() {
return name;
}
}
***makes sence
+plash razdan IntelliJ helps you create getters and setters easily too