JavaFX Java GUI Tutorial - 11 - CheckBox

Поділитися
Вставка
  • Опубліковано 21 сер 2024
  • Source Code: github.com/the...
    Core Deployment Guide (AWS): docs.google.co...

КОМЕНТАРІ • 47

  • @shakirahafeez6692
    @shakirahafeez6692 4 роки тому +7

    the best teacher I've come across

  • @rimantasri4578
    @rimantasri4578 3 роки тому +1

    5:39 - *thinking intensifies.*

  • @kennyPAGC
    @kennyPAGC 8 років тому +3

    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) {
    System.out.println(String.join(
    ", ",
    Arrays.stream(boxes).filter(CheckBox::isSelected).map(CheckBox::getText).collect(Collectors.toList())
    ));
    }

  • @heidtb6746
    @heidtb6746 5 років тому +2

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

  • @chrisis1993
    @chrisis1993 4 роки тому +4

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

  • @lechi_2002
    @lechi_2002 8 років тому +2

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

    • @hossamnasser9717
      @hossamnasser9717 4 роки тому

      Where Exactly Did He Need To Do This In That Tutorial ?

  • @hedgehogurchin16
    @hedgehogurchin16 9 років тому +3

    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

  • @mohammadmahdifarrokhy260
    @mohammadmahdifarrokhy260 Рік тому

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

  • @sternenmeersegler
    @sternenmeersegler 3 роки тому +2

    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. :)

  • @marindedic441
    @marindedic441 4 роки тому +1

    Make a checkbox array and use this code for printing out the order:
    public void printOrder(){
    String message = "Order:
    ";
    for (CheckBox checkBox : checkBoxes){
    message += checkBox.isSelected() ? checkBox.getText() + "
    " : "";
    }
    System.out.println(message);
    }
    It's much more flexible.

    • @PrinceJJGoated
      @PrinceJJGoated 4 роки тому

      Good example
      Cuts down on repetition and makes it easy adding / removing checkboxes

  • @thilinamadhushanbandarawic4616
    @thilinamadhushanbandarawic4616 3 роки тому

    Thanks. Best solution for my issue.

  • @SenseiEli
    @SenseiEli 3 роки тому

    Thank you again! Great job!

  • @playhelm
    @playhelm 8 років тому +2

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

  • @sangyunlee1002
    @sangyunlee1002 7 років тому

    i am so much thx for making this. thx

  • @troinfovideo
    @troinfovideo 8 років тому

    They are called a 'hero' here in NY.

  • @asdfwerqewsd
    @asdfwerqewsd 8 років тому +3

    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

    • @playwarrior1232
      @playwarrior1232 8 років тому +3

      Yes you can use a forloop to loop through all of the checkboxes and see if. They are selected

  • @aniskadri140
    @aniskadri140 2 роки тому

    thank you

  • @MUHAMMADZIKRIBINZAKARIAUPM
    @MUHAMMADZIKRIBINZAKARIAUPM Рік тому +1

    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.

  • @alirezaheidari1518
    @alirezaheidari1518 4 роки тому +2

    you can type "sout" and press enter instead of type system.out.println()

  • @UninspiredFilm5
    @UninspiredFilm5 Рік тому

    Some people call them heroes

  • @ECCOWAFL
    @ECCOWAFL 9 років тому +2

    i call my home-made subs hogies

  • @blazefrostrider
    @blazefrostrider 7 років тому +2

    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( String.valueOf(Integer.parseInt(total.getText()) + rate));
    else
    total.setText( String.valueOf(Integer.parseInt(total.getText()) - rate));
    }

  • @soumyadeeppaul8142
    @soumyadeeppaul8142 4 роки тому

    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 :(

  • @waelfarhatfullstackdevelop8467
    @waelfarhatfullstackdevelop8467 7 років тому +3

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

    • @drcod3r329
      @drcod3r329 5 років тому +3

      you need to use radio button instead

  • @SpartanOdyssey
    @SpartanOdyssey 7 років тому

    Hoagies for life man!

  • @mikkeedamo5458
    @mikkeedamo5458 4 роки тому

    We can improve this by
    private void handleOptions(CheckBox... boxes) {
    System.out.println("Users order: ");
    for(CheckBox box : boxes ) {
    if(box.isSelected()
    System.out.println(box.getText());
    }
    }

  • @TheThinker-ug3wr
    @TheThinker-ug3wr 6 років тому +1

    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....

    • @mayobyohassan500
      @mayobyohassan500 6 років тому +1

      i am sure by now your already doing java programming, after this he will introduce scene builder, which is used to build these layouts faster and better.

    • @TheThinker-ug3wr
      @TheThinker-ug3wr 6 років тому

      Thank u #Mayobyo Hassan....

  • @jakebyford9804
    @jakebyford9804 3 роки тому

    Some people call subs 'Heros'

  • @jaygarzon6709
    @jaygarzon6709 4 роки тому

    I am here 2020

  • @brenocampos100
    @brenocampos100 5 років тому

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

  • @steveandrews2121
    @steveandrews2121 8 років тому

    Hey - not that you could tell, but all i eat is meat and dairy in a Sub, only thing close to salad/fruit/vegetable is Tomato Sauce... LOL

  • @emilbogaci3715
    @emilbogaci3715 2 роки тому

    what is vBox?

  • @psychodycho
    @psychodycho 7 років тому

    I want to order bacontuna.

  • @o0QuAdSh0t0o
    @o0QuAdSh0t0o 2 роки тому

    Stromboli

  • @pablofonseca8867
    @pablofonseca8867 4 роки тому

    //Handle checkbox options
    private void handleOptions(JFXCheckBox... args){
    StringBuilder elementsSelected = new StringBuilder();
    for (JFXCheckBox arg : args) {
    if (arg.isSelected()) {
    elementsSelected.append(arg.getText()).append("
    ");
    }
    }
    AlertBox.display("Alert Box", "Elements selected:
    " + elementsSelected);
    }

  • @marcellino3561
    @marcellino3561 3 роки тому

    P

  • @EbonyBunny1
    @EbonyBunny1 8 років тому +5

    A sub is a Hero in New York City

  • @yunusemrrkorkmaz
    @yunusemrrkorkmaz Рік тому

    it has been 7 years but i need to know. For example, we want to save our customers order patterns. and lets say we have 7 checkboxes, they always check 4 of them. how can we save this. even after they closed the app. i dont know how "keep me logged in" works but i guess it saves our history and uses them. So, I just want to know how to save lets say previous checked boxes. Can someone help me ? @thenewboston ?