This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private final StringProperty firstName = new SimpleStringProperty("Alloysius"); | |
public String getFirstName() { | |
return firstName.get(); | |
} | |
public StringProperty firstNameProperty() { | |
return firstName; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class KotlinClass() { | |
public var nickName: String = "" | |
} | |
fun main(args: Array<String>) { | |
val testClass = KotlinClass() | |
testClass.nickName = "Shorty" | |
println("Nickname: $testclass.nickName") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class KotlinClass() { | |
public var nickName: String = "" | |
set(value) { | |
field = value | |
println("in the setter") | |
} | |
get() { | |
println("in the getter") | |
return field | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class KotlinClass() { | |
private val _nickName: ObjectProperty<String> = SimpleObjectProperty("") | |
var nickName: String | |
get() = _nickName.get() | |
set(value) = _nickName.set(value) | |
fun nickNameProperty() = _nickName | |
} | |
fun main(args: Array<String>) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private val _$PROPERTY$: ObjectProperty<$PROPERTY_TYPE$> = SimpleObjectProperty($INIT_VAL$) | |
var $PROPERTY$: $PROPERTY_TYPE$ | |
get() = _$PROPERTY$.get() | |
set(value) = _$PROPERTY$.set(value) | |
fun $PROPERTY$Property() = _$PROPERTY$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Sample { | |
private int intField = 0; | |
public int getIntField() { | |
return intField; | |
} | |
public void setIntField(int newValue) { | |
intField = newValue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Sample { | |
var intField: Int = 0 | |
} | |
fun UseSample() { | |
val sample = Sample() | |
sample.setIntField(3) | |
println(sample.getIntField()) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Sample { | |
var intField: Int = 0 | |
} | |
fun UseSample() { | |
val sample = Sample() | |
sample.inField = 3 | |
println(sample.intField) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun handleNullable() { | |
val customer: Customer? = database.fetchCustomer(customerId) | |
val customerName:String = customer?.let{it.getName()}?: "Mr. Nobody" | |
println("The customer name is $customerName") | |
} | |
fun betterHandleNullable() { | |
println("The customer name is " + database.fetchCustomer(customerId)?.name ?: "Mr. Nobody") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hbox.children += ImageView(Image(path.toExternalForm())).apply { | |
fitHeight = 600.0 | |
isPreserveRatio = true | |
opacity = 0.7 | |
} |
OlderNewer