JavaFX ChoiceBox 🔽

Поділитися
Вставка

КОМЕНТАРІ • 38

  • @BroCodez
    @BroCodez  3 роки тому +10

    package application;
    import java.net.URL;
    import java.util.ResourceBundle;
    import javafx.event.ActionEvent;
    import javafx.fxml.FXML;
    import javafx.fxml.Initializable;
    import javafx.scene.control.ChoiceBox;
    import javafx.scene.control.Label;
    public class Controller implements Initializable{
    @FXML
    private Label myLabel;

    @FXML
    private ChoiceBox myChoiceBox;

    private String[] food = {"pizza","sushi","ramen"};
    @Override
    public void initialize(URL arg0, ResourceBundle arg1) {

    myChoiceBox.getItems().addAll(food);
    myChoiceBox.setOnAction(this::getFood);

    }

    public void getFood(ActionEvent event) {

    String myFood = myChoiceBox.getValue();
    myLabel.setText(myFood);
    }
    }

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

    YOU ARE THE BEST BRO I'VE EVER SEEN ON UA-cam

  • @namenachname4999
    @namenachname4999 3 роки тому +3

    There are people like you, which make this videos and there are people like me which watch this videos and give some love in the comments to defeat the algorythm

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

    YO, It's my favorite Bro 🙌🏾🙌🏾🙌🏾💻

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

    thanks bro, you are really good and so easy to follow. XD

  • @metalgoat69
    @metalgoat69 11 місяців тому

    Thanks bro! This helped me a lot

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

    Thanks, Bro!! Very helpfull

  • @HoboSquirrel12
    @HoboSquirrel12 2 роки тому +1

    How would you go about populating a choicebox with strings that are generated at run time?

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

    it worked, thanks!

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

    Thank you very much

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

    Do you have a video going into more detail about the method reference operator you use? I'm not quite grasping it. I think it's a type of lambda, and it shortens a lambda even more, but not sure how. Thanks!

  • @JuanaPaivaTavares
    @JuanaPaivaTavares 8 місяців тому

    Thank you!!!!

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

    For some reason I got an error unless I declared the attributes as public. Thanks for the tutorial!

  • @UltramateSL
    @UltramateSL 3 місяці тому

    Thank You

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

    Thx Bro!

  • @Linebeck
    @Linebeck 2 роки тому +1

    Hi thank you! A little question:
    How can I use a value String in the checkbox as default?
    Because when you run the program you can't see any string (but when you do your food choise then you can read it).
    For example I want to see the string "foods" in the checkbox at the beginnig

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

      One way to do this is to edit your FXML for your ChoiceBox, add the line (value = ""the Text You Want To See At The Beginning")
      I hope this helps

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

      myChoiceBox.setValue("Choose Food");

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

    Thanks

  • @chemso_1
    @chemso_1 2 місяці тому

    da best

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

    Just realised that you have your own element: BROmine

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

    thanx!

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

    What if we want to use an existing Enum we have?

  • @jadizadi7600
    @jadizadi7600 3 місяці тому

    is there an option to add the items to be selected in scenbuilder itself under the Combobox component instead of writing them in code as Strings ?
    I want to add the items to be selected in scenbuilder itself under the Combobox component like how MenuButton component has MenuItems to be selected under it in Scenbuilder? because i want when i select one option from Compobox i want the program to get me into another user interface. what is the appropriate componant for that?

  • @ghofranalzreikat
    @ghofranalzreikat 8 місяців тому

    Hi, Thank you for the tutorial, but Mine did not work, I am not sure why. Any ideas? is there something special I should do in the Main.java?

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

    how to do multi-selection in that choice box

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

    thank you is not enough...good example

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

    In my case it didn't work, until I initialised myChoiceBox [ChoiceBox myChoiceBox = new ChoiceBox();]

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

      THANK YOU SO MUCH, I was going crazy trying to find out why it doesn't work

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

    Hey bro! I cannot shorten my combo box size when it reachs 30px. anyone, help me plz!

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

    nice tutorial, but what if want to show an image of pizza, sushi or ramen instead of label?

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

      create an imageviewer in scene builder.
      in your controller class just use if statements to get images displayed

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

    Hi. The audio and subtitles of this video were incorrectly identified as Vietnamese

  • @z2.060
    @z2.060 3 роки тому

    hey i have a question, i learned python language and wanted to know how can i get a job ?

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

      build some projects to include in a portfolio

    • @z2.060
      @z2.060 3 роки тому

      @@BroCodez what is a portofolio and yes i made some projects, should i post them on github, and where can i get the job ?

  • @benderbg
    @benderbg 9 місяців тому

    Someone nuked the transcript of this video.