observablelist

ConcurrentModificationException while using Iterator<Node> [duplicate]

≡放荡痞女 提交于 2021-02-17 03:29:32
问题 This question already has answers here : Concurrent Modification Exception : adding to an ArrayList (10 answers) Closed 7 months ago . I was trying to delete a row of JavaFX GridPane with JavaFX Rectangles and I found no way to do so but copying the squares above to one row below . Here is my code to do that but it keeps throwing ConcurrentModificationAcception . static void copyAbove(int rowToBeDisappear, GridPane mainGrid) { for (int y = (rowToBeDisappear-1); 0 <= y ; y--) { for (int x = 0;

Why does JavaFX table.getItems().clear() clear the ObservableList as well

送分小仙女□ 提交于 2020-01-06 03:55:07
问题 I've a JavaFX table defined as: TableView<Person> table = new TableView<>; //Person Class contains firstName,lastName & email properties //table has three columns First Name, Last Name & Email An ObservableList of Person s ObservableList<Person> persons = FXCollections.observableArrayList(); A background service, which task is to populate the table dynamically by adding entries( Person objects) to the ObservableList persons . table is binded as: table.itemsProperty().bind(service

How to make object in List eligible for garbage collection?

只愿长相守 提交于 2020-01-03 20:02:40
问题 I understand that when an object is added to a List, the List retains a reference to that object based on answer from this question Is this java Object eligible for garbage collection in List How then how do you make the object in the List eligible for garbage collection so that it's removed from the heap and not taking up memory? I ask because in JavaFX, a Vboxs getChildren method returns observable list containing the children nodes of the vbox. If a UI element is removed but not eligible

Populating a TableView with a HashMap that will update when HashMap changes

删除回忆录丶 提交于 2020-01-02 18:14:29
问题 I have followed this post Binding hashmap with tableview (JavaFX) and created a TableView that is populated by data from a HashMap. The TableView receives its data from a HashMap called map by creating an ObservableList from map.entrySet() and handing that ObservableList off to the TableView 's constructor. (Code is below) However, although it's an ObservableList with SimpleStringProperty s, the TableView does not update when changes are made to the underlying HashMap. Here is my code: public

JavaFX, ObservableList: How to fire an InvalidationListener whenever an object of the list gets modified?

笑着哭i 提交于 2020-01-01 19:30:44
问题 Say I have a JavaFX app with an observable class SomeObservableClass with some Properties: public class SomeObservableClass{ private StringProperty prop1 = new SimpleStringProperty(); private DoubleProperty prop2 = new SimpleDoubleProperty(); ... constructors, getters and setters } and another class which has a property: public class ParentClass{ private ObservableList<SomeObservableClass> sOC = FXCollections.observableArrayList();` } In this parent class I add a listener for the observable

Does the use of ObservableList in JavaFX go against Model-View-Controller separation?

折月煮酒 提交于 2019-12-29 06:44:30
问题 I am attempting a study of JavaFX because I want to use it as the GUI of my program. My question is essentially a conceptual one: To date my program is mostly the "Model" part of the MVC pattern; that is, almost all of my code is the OO-representation of abstractions in the sense of classes, and all of that code is logical code. Since I do not want to be the only user of my program, I want to add the "View" part of MVC so that people can easily use and manipulate the "Model" part of my

JavaFX bad design: Row identity in observable lists behind the TableView?

↘锁芯ラ 提交于 2019-12-24 07:16:42
问题 Suppose I am displaying very long table with TableView. Manual says, TableView is designed to visualize an unlimited number of rows of data So, since million of rows won't fit the RAM, I would introduce some caching. This means, that ObservableList#get() is allowed to return different instances for the same row index. Is this true? What about opposite? May I return the same instance for all row indices filled with different data? I noticed, that this implies some problem with row editing. At

Configuring a TreeView which scans Local fie system to only include folders which have a file type

此生再无相见时 提交于 2019-12-23 22:11:36
问题 Okay so I used the second block of code from this website http://www.java2s.com/Tutorials/Java/JavaFX/0660__JavaFX_Tree_View.htm where it states "The following code create a dynamic tree from the local file system" I do not understand how this code works in order to customise it to my needs. Particularly the overriding methods, there did not seem to be a place where I could add in "only add folders down to the sub directory which contain mp3 files". I reckon it's likely going to require

ObservableList doesn't update ArrayList

丶灬走出姿态 提交于 2019-12-23 16:38:54
问题 For a school assignment, we're working with ObservableList objects from JavaFX (Right?). I've been working on this for over a day now and can't figure it out. The teacher only tells us to 'Google it' so that's no help either.. Basically, we're working on a basic administration application to keep track of people and their families. Where people are member of a family, and a family can have multiple members. When a person or family is added, they are added to an observableList which should

Why are there no ObservableQueues in JavaFX?

匆匆过客 提交于 2019-12-19 05:56:10
问题 Why are there no ObservableQueue in JavaFX? If we look at the Java 9 documentation (just to see if there are any changes from 8) for FXCollections, we see static helper methods to create Observable sets, lists, and maps. There are also some methods to create Observable float and integer arrays. However, there is no way to create an ObservableQueue. The Queue interface in Java has many interesting implementations, including ArrayDeque, DelayQueue, ConcurrentLinkedQueue, PriorityQueue, etc.