JavaFX ListView 🧾

Поделиться
HTML-код
  • Опубликовано: 17 ноя 2024

Комментарии • 27

  • @BroCodez
    @BroCodez  3 года назад +17

    package application;
    import java.net.URL;
    import java.util.ResourceBundle;
    import javafx.beans.value.ChangeListener;
    import javafx.beans.value.ObservableValue;
    import javafx.fxml.FXML;
    import javafx.fxml.Initializable;
    import javafx.scene.control.Label;
    import javafx.scene.control.ListView;
    import javafx.scene.control.Spinner;
    import javafx.scene.control.SpinnerValueFactory;
    import javafx.scene.control.SpinnerValueFactory.IntegerSpinnerValueFactory;
    public class Controller implements Initializable{
    @FXML
    private ListView myListView;

    @FXML
    private Label myLabel;

    String[] food = {"pizza","sushi","ramen"};

    String currentFood;

    @Override
    public void initialize(URL arg0, ResourceBundle arg1) {

    myListView.getItems().addAll(food);

    myListView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() {
    @Override
    public void changed(ObservableValue

  • @andresbohorquez3193
    @andresbohorquez3193 Месяц назад +1

    The first time I saw this video, I was just trying to learn new things about javafx. This second time, u saved my live and a work I have been doing for two days. Thx so much!

  • @alexop5919
    @alexop5919 3 года назад +3

    Thank you Bro Code!
    You doing very informative and awesome videos!
    JavaFX is kinda hard, but you doing it workable. Great job

  • @odinsrensen7460
    @odinsrensen7460 Год назад

    Very useful, especially that one line in you stickied comment.

  • @Merlock1010
    @Merlock1010 2 года назад

    I have a shoppingcart with a listview with the amount for each product you ordered. With a button you can remove one amount of the product you've selected. The amount get succesfully removed however my listview doesn't update realtime and I have to exit and open the shoppingcart scene to update it.
    How would I go about updating my listview after I clicked on the remove button?

  • @isoiso1371
    @isoiso1371 2 года назад

    how do i do this for checkbox i have a program i have to do for school where there is gamename, gameplatform, radiobuttons and checkbox how would this be applicable for checkboxes and radiobuttons

  • @pauldest1158
    @pauldest1158 3 года назад +1

    Hi!! can you tell me what's equivalent of ttk.Notebook in Java, please!!

  • @parsa8533
    @parsa8533 2 года назад +4

    Hey Bro
    when I try to do
    myListView.getItems().addAll();
    it says:
    Cannot invoke "javafx.scene.control.ListView.getItems()" because "this.myListView" is null

    • @tayuraaa
      @tayuraaa 11 месяцев назад

      i have the same problem!! Have you been able to fix it??

    • @parsa8533
      @parsa8533 11 месяцев назад

      @@tayuraaa hey man. It was a long time ago, I don't exactly remember. I just remember I found a way around it by using TreeView instead of ListView.
      Anyways, I did my project before Chat GPT was a thing, so try getting help from Chat.
      Best of luck!

    • @nanakwameampomah9545
      @nanakwameampomah9545 8 месяцев назад

      I've think that means the fxml injection of the component didn't work

  • @QuangPham-bc7lc
    @QuangPham-bc7lc 3 года назад

    if i have a listview and i want to use it like in a dictionary, how i can update my listview while typing word

  • @hanekaii
    @hanekaii 3 года назад +1

    i can't select anything on my list any help??

  • @rolindets47
    @rolindets47 Год назад

    Whats up bro. So i have a project that a user will input customer data. Once they input it is it best to use a list view to display it as an existing customer? If so how do i add textfield data to the myListView?

  • @kingpin9999
    @kingpin9999 3 года назад

    Can you make a TableView guide please?

  • @xs_ahmed2051
    @xs_ahmed2051 Год назад

    you are a real CHAD

  • @shahnoorraza8514
    @shahnoorraza8514 3 года назад +2

    Reduced Code:
    @Override
    public void initialize(URL url, ResourceBundle resourceBundle) {
    myListView.getItems().addAll(foodItems);
    myListView.getSelectionModel().selectedItemProperty().addListener(
    (var,oldValue,newValue) -> {
    currentFood = myListView.getSelectionModel().getSelectedItem();
    myLabel.setText(currentFood);
    }
    );
    }

  • @chaithdridi2718
    @chaithdridi2718 3 года назад +1

    Thank you Bro

  • @kmf9709
    @kmf9709 3 года назад

    thanks a lot, you need to know this this really help me!!!

  • @The121314diego
    @The121314diego 10 месяцев назад

    Good Video, thx

  • @eliy5550
    @eliy5550 Год назад

    LIFE SAVER!!!

  • @neil_armweak
    @neil_armweak 3 года назад

    Thank you, very cool

  • @amolgahane5762
    @amolgahane5762 3 года назад

    Hey it's really helpful please keep it up #brocode
    Your all video is damn good 🤠🤠

  • @NotReallyBlue
    @NotReallyBlue 3 года назад

    underrated

  • @pawe7420
    @pawe7420 Год назад

    Thx Bro!

  • @larrysmusics531
    @larrysmusics531 3 года назад +1

    Javafx is dead