JavaFX Java GUI Tutorial - 11 - CheckBox

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

10 years later, and the tutorials still work. That is honestly crazy. Man, this guy is the best java teacher I've ever seen

Electricalgamesofficial
Автор

I know this videos are pretty old but it is still really helpful even tho some commands are out of date (tbh so far I met only 1 out of date command). Best java teacher I ever learned from, thank you for making these videos!

okolegoleg
Автор

the best teacher I've come across <3

shakirahafeez
Автор

If anyone is interested in Java 8, you can do the "handleOptions" method like this (the output will be something like "Bacon, Tuna, Beef" and the call is just handleOptions(box1, box2, box3) or whatever checkboxes you have):

private void handleOptions(CheckBox... boxes) {

", ",

));
}

kennyPAGC
Автор

hi, how can we select only one check box and not more than that. Basically i want to create checkbox for gender. So only one gender can be selected. Hope to hear any answer soon.

MUHAMMADZIKRIBINZAKARIAUPM
Автор

thanks a lot for your tutorial. up from line47 you don't have to write bacon/tuna... its more useful to work with gettext, in case, that the checkbox-text changes later (for not adapting manually in the code ;)). igual! thank you. :)

sternenmeersegler
Автор

when you want to combine two Strings use string1.concat(string2)

lechi_
Автор

Insets(20, 20, 20, 20) can be simplified to Insets(20)

chrisis
Автор

Make a checkbox array and use this code for printing out the order:
public void printOrder(){
String message = "Order: \n";

for (CheckBox checkBox : checkBoxes){
message += checkBox.isSelected() ? checkBox.getText() + "\n" : "";
}

System.out.println(message);
}

It's much more flexible.

marindedic
Автор

What if you have many checkboxes, it seems strange to use an if + else statement for all of them. Is it possible to process them through an array (+ for loop) or something similar? Sorry I'm a newb to java

asdfwerqewsd
Автор

i know it comes late, but your tutorials are awesome :D

heidtb
Автор

such an useful course it was. Thank you for making it

mohammadmahdifarrokhy
Автор

Hoagies, grinders, po'boys, spuckies, or even "wedges". I think that covers all the "Subs" names. Now please update your video to include these :D

hedgehogurchin
Автор

hi, how to select just one checkbox, (to choose just one option)?

waelfarhatfullstackdevelop
Автор

How i disable for the user dont check/uncheck? i want to use this as a flag status...

brenocampos
Автор

Welcome to Bucky's meat subs ... do you want some meat with that?

playhelm
Автор

They are called a 'hero' here in NY.

troinfovideo
Автор

Real Time Billing


public void start(Stage primaryStage) throws Exception{

CheckBox idli = new CheckBox("Idli");
CheckBox vada = new CheckBox("Vadai");
CheckBox dosa = new CheckBox("Dosa");
total = new TextField("0");



idli.setOnAction(e->
{
Update(idli, 8);
}
);

vada.setOnAction(e->
{
Update(vada, 6);
}
);

dosa.setOnAction(e->
{
Update(dosa, 45);
}
);


VBox vb = new VBox(40);

vb.getChildren().addAll(dosa, idli, vada, total);

vb.setAlignment(Pos.CENTER);

Scene scene = new Scene(vb, 500, 500);

primaryStage.setScene(scene);

primaryStage.show();



}


public static void main(String[] args) {
launch(args);
}

private void Update(CheckBox check, int rate)
{
if(check.isSelected())
total.setText( + rate));
else
total.setText( - rate));

}

blazefrostrider
Автор

Sir What should i learn after learning this whole tutorials of java fx...plesae sir guide me..i want to learn the programming...i am a software Engineering Student....

TheThinker-ugwr
Автор

your videos are just awesome but just it would have been better if you would have zoomed in the code while typing as it would have been more readable. Currently its too small to read properly :(

sahistocks