- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我在表格内有一个表格 View ,我有一个复选框,当我选择行以选中此复选框并取消选择其他复选框时,我需要一些东西我通过在 TableView 上设置监听器并迭代列表项并将选中的行设置为 false 并仅将选定的行设置为 true 来解决它,但我遇到的问题是当我调用 ObservableList.setall(...) 时,我在代码后得到了这些异常
AccountingFilesTable.getSelectionModel().selectedItemProperty().addListener(
(observable, oldValue, newValue) -> showAccountingFilesDetails(newValue));
private void showAccountingFilesDetails(AccountingFiles newValue) {
AccountingFiles curraccfile = AccountingFilesTable.getSelectionModel().getSelectedItem();
AccountingFilesTable.getSelectionModel().clearSelection();
System.out.println(curraccfile.getAccountingFilesName());
for (AccountingFiles af : accountingData) {
mainEm.getTransaction().begin();
af.setAccountingFilesActiveStatus(false);
mainEm.getTransaction().commit();
//accountingData.set(accountingData.indexOf(af), af);
System.out.println("in looooooooooooop");
}
mainEm.getTransaction().begin();
curraccfile.setAccountingFilesActiveStatus(true);
mainEm.getTransaction().commit();
List<AccountingFiles> listOfAccountingFiles = mainEm.createNamedQuery("AccountingFiles.findAll").getResultList();
accountingData.setAll(listOfAccountingFiles);
}
Exception in thread "JavaFX Application Thread" java.lang.IndexOutOfBoundsException
at com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList.subList(ReadOnlyUnbackedObservableList.java:136)
at javafx.collections.ListChangeListener$Change.getAddedSubList(ListChangeListener.java:242)
at javafx.scene.control.TableView$TableViewArrayListSelectionModel.handleSelectedCellsListChangeEvent(TableView.java:2959)
at javafx.scene.control.TableView$TableViewArrayListSelectionModel.clearAndSelect(TableView.java:2395)
at javafx.scene.control.TableView$TableViewSelectionModel.clearAndSelect(TableView.java:1898)
at com.sun.javafx.scene.control.behavior.TableCellBehaviorBase.simpleSelect(TableCellBehaviorBase.java:215)
at com.sun.javafx.scene.control.behavior.TableCellBehaviorBase.doSelect(TableCellBehaviorBase.java:148)
at com.sun.javafx.scene.control.behavior.CellBehaviorBase.mousePressed(CellBehaviorBase.java:150)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:95)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3758)
at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3486)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2495)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:350)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:275)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$350(GlassViewEventHandler.java:385)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$$Lambda$176/1128584231.get(Unknown Source)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:404)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:384)
at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
at com.sun.glass.ui.View.notifyMouse(View.java:927)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$145(WinApplication.java:101)
at com.sun.glass.ui.win.WinApplication$$Lambda$36/1030870354.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
请帮助我摆脱这个困境,我已经在这些异常中储备了好几天了,因为我的 TableView 工作正常,但这些异常仍然存在。
这是我的完整类实现 包front.view;
import back.entities.AccountingFiles;
import back.entities.AccountingFilesDetails;
import back.utility.Connector;
import hal.main.MainApp;
import java.net.URL;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.ResourceBundle;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.ContentDisplay;
import javafx.scene.control.Label;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.CheckBoxTableCell;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.control.cell.TextFieldTableCell;
import javax.persistence.EntityManager;
public class AccountingFilesFormController implements Initializable {
@FXML
private TableView<AccountingFiles> AccountingFilesTable;
@FXML
private TableView<AccountingFilesDetails> AccountingFilesDetailsTable;
@FXML
private TableColumn<AccountingFilesDetails, Boolean> accountingFilesDetailsSelectedFile;
@FXML
private TableColumn<AccountingFilesDetails, LocalDate> accountingFilesDetailsStartDate;
@FXML
private TableColumn<AccountingFilesDetails, LocalDate> accountingFilesDetailsEndDate;
@FXML
private TableColumn<AccountingFilesDetails, String> accountingFilesDetailsFileName;
@FXML
private TableColumn<AccountingFilesDetails, String> accountingFilesDetailsLocation;
@FXML
private TableColumn<AccountingFilesDetails, String> accountingFilesDetailsBackupLocation;
@FXML
private TableColumn<AccountingFilesDetails, Boolean> accountingFilesDetailsClosed;
@FXML
private TableColumn<AccountingFiles, Boolean> currentAccountingSelectedFile;
@FXML
private TableColumn<AccountingFiles, String> accountingFileName;
@FXML
private TableColumn<AccountingFiles, String> accountingFilePassword;
private ObservableList<AccountingFiles> accountingData = FXCollections.observableArrayList();
private ObservableList<AccountingFilesDetails> accountingDetails = FXCollections.observableArrayList();
EntityManager mainEm = Connector.getMainEntityManager();
;
MainApp mainApp;
public void setMainApp(MainApp mainApp) {
this.mainApp = mainApp;
System.out.println(AccountingFilesTable);
}
@Override
public void initialize(URL url, ResourceBundle rb) {
accountingFileName.setCellValueFactory(new PropertyValueFactory<AccountingFiles, String>("accFileName"));
accountingFileName.setCellFactory(TextFieldTableCell.<AccountingFiles>forTableColumn());
accountingFilePassword.setCellValueFactory(new PropertyValueFactory<AccountingFiles, String>("accFilePassword"));
accountingFilePassword.setCellFactory(param -> new PasswordLabelCell());
currentAccountingSelectedFile.setCellValueFactory(new PropertyValueFactory<AccountingFiles, Boolean>("currentAccSelectedFile"));
currentAccountingSelectedFile.setCellFactory(CheckBoxTableCell.forTableColumn(currentAccountingSelectedFile));
currentAccountingSelectedFile.setEditable(false);
AccountingFilesTable.setEditable(true);
addingItems();
AccountingFilesTable.getSelectionModel().selectedItemProperty().addListener(
(observable, oldValue, newValue) -> showAccountingFilesDetails(newValue));
}
public void addingItems() {
List<AccountingFiles> listOfAccountingFiles = mainEm.createNamedQuery("AccountingFiles.findAll").getResultList();
accountingData.addAll(listOfAccountingFiles);
AccountingFilesTable.setItems(accountingData);
}
@FXML
private void handleSelect() {
System.out.println("begin handleSelect");
AccountingFiles curraccfile = AccountingFilesTable.getSelectionModel().getSelectedItem();
AccountingFilesTable.getSelectionModel().clearSelection();
System.out.println("after clearSelection");
System.out.println(curraccfile.getAccountingFilesName());
for (AccountingFiles af : accountingData) {
mainEm.getTransaction().begin();
af.setAccountingFilesActiveStatus(false);
mainEm.getTransaction().commit();
System.out.println("in looooooooooooop");
}
System.out.println("after the loop finished");
mainEm.getTransaction().begin();
curraccfile.setAccountingFilesActiveStatus(true);
mainEm.getTransaction().commit();
System.out.println("after the lastcommit of finished");
List<AccountingFiles> listOfAccountingFiles = mainEm.createNamedQuery("AccountingFiles.findAll").getResultList();
accountingData.setAll(listOfAccountingFiles);
System.out.println("after setall method");
}
private void showAccountingFilesDetails(AccountingFiles newValue) {
handleSelect();
}
}
}
public class PasswordLabelCell extends TableCell<AccountingFiles, String> {
private Label label;
public PasswordLabelCell() {
label = new Label();
this.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
this.setGraphic(null);
}
private String genDotString(int len) {
String dots = "";
for (int i = 0; i < len; i++) {
dots += "\u2022";
}
return dots;
}
@Override
protected void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
if (!empty) {
label.setText(genDotString(item.length()));
setGraphic(label);
} else {
setGraphic(null);
}
}
}
}
这是全类。我尝试添加按钮,并在 Action 监听器上调用 showAccountingFilesDetails 它有效,没有发生异常,但我不明白为什么,我不想选择行并按按钮来执行我的代码,这样做很尴尬......
嘿伙计们,谢谢大家的回复,我已经做了一个 MCVE,就在那里
import java.util.Arrays;
import java.util.List;
import javafx.application.Application;
import javafx.beans.Observable;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.CheckBoxTableCell;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
import javafx.util.Callback;
public class TableWithCheckbox extends Application {
final TableView<Player> table = new TableView<Player>();
ObservableList<Player> data;
@Override
public void start(Stage primaryStage) {
final BorderPane root = new BorderPane();
table.setItems(createData());
final TableColumn<Player, String> firstNameColumn = new TableColumn<>("First Name");
final TableColumn<Player, String> lastNameColumn = new TableColumn<>("Last Name");
final TableColumn<Player, Boolean> selectedColumn = new TableColumn<>("selected");
firstNameColumn.setCellValueFactory(new PropertyValueFactory<Player, String>("firstName"));
lastNameColumn.setCellValueFactory(new PropertyValueFactory<Player, String>("lastName"));
selectedColumn.setCellValueFactory(new PropertyValueFactory<Player, Boolean>("selected"));
final Callback<TableColumn<Player, Boolean>, TableCell<Player, Boolean>> cellFactory = CheckBoxTableCell.forTableColumn(selectedColumn);
selectedColumn.setCellFactory(new Callback<TableColumn<Player, Boolean>, TableCell<Player, Boolean>>() {
@Override
public TableCell<Player, Boolean> call(TableColumn<Player, Boolean> column) {
TableCell<Player, Boolean> cell = cellFactory.call(column);
cell.setAlignment(Pos.CENTER);
return cell;
}
});
selectedColumn.setCellFactory(cellFactory);
selectedColumn.setEditable(false);
table.setEditable(true);
table.getColumns().addAll(selectedColumn, firstNameColumn, lastNameColumn);
root.setCenter(table);
Button button1 = new Button("add");
button1.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
data.add(new Player("hbghj", "hjhbbccc77", false));
}
});
root.setTop(button1);
primaryStage.setScene(new Scene(root, 400, 600));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
private ObservableList<Player> createData() {
List<Player> players = Arrays.asList(
new Player("Hugo", "Lloris", true),
new Player("Brad", "Friedel", false),
new Player("Kyle", "Naughton", false),
new Player("Younes", "Kaboul", false),
new Player("Benoit", "Assou-Ekotto", false),
new Player("Jan", "Vertonghen", false),
new Player("Michael", "Dawson", false),
new Player("William", "Gallas", false),
new Player("Kyle", "Walker", false),
new Player("Scott", "Parker", false),
new Player("Mousa", "Dembele", false),
new Player("Sandro", "Cordeiro", false),
new Player("Tom", "Huddlestone", false),
new Player("Gylfi", "Sigurdsson", false),
new Player("Gareth", "Bale", false),
new Player("Aaron", "Lennon", false),
new Player("Jermane", "Defoe", false),
new Player("Emmanuel", "Adebayor", false)
);
data = FXCollections.<Player>observableArrayList(
new Callback<Player, Observable[]>() {
@Override
public Observable[] call(Player player) {
return new Observable[]{player.selectedProperty()};
}
}
);
data.addAll(players);
data.addListener(new ListChangeListener<Player>() {
@Override
public void onChanged(
javafx.collections.ListChangeListener.Change<? extends Player> change) {
System.out.println("List changed");
while (change.next()) {
if (change.wasUpdated()) {
System.out.println("What code a do here");
System.out.println();
}
}
}
});
table.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() {
@Override
public void changed(ObservableValue observableValue, Object oldValue, Object newValue) {
Player currPlayer = table.getSelectionModel().getSelectedItem();
table.getSelectionModel().clearSelection();
System.out.println("after clearSelection");
for (Player pl : players) {
pl.setSelected(false);
}
currPlayer.setSelected(true);
}
});
return data;
}
public static class Player {
private final StringProperty firstName;
private final StringProperty lastName;
private final BooleanProperty selected;
Player(String firstName, String lastName, boolean international) {
this.firstName = new SimpleStringProperty(this, "firstName", firstName);
this.lastName = new SimpleStringProperty(this, "lastName", lastName);
this.selected = new SimpleBooleanProperty(this, "selected", international);
}
public String getFirstName() {
return firstName.get();
}
public void setFirstName(String firstName) {
this.firstName.set(firstName);
}
public StringProperty firstNameProperty() {
return firstName;
}
public String getLastName() {
return lastName.get();
}
public void setLastName(String lastName) {
this.lastName.set(lastName);
}
public StringProperty lastNameProperty() {
return lastName;
}
public boolean isSelected() {
return selected.get();
}
public void setSelected(boolean international) {
this.selected.set(international);
}
public BooleanProperty selectedProperty() {
return selected;
}
@Override
public String toString() {
return firstName.get() + " " + lastName.get() + (selected.get() ? " (injured)" : "");
}
}
}
出现同样的问题,同样的异常,请帮忙
最佳答案
确实没有时间清理代码。请多多包涵。这是您发布的任何内容的工作模型。
import java.util.Arrays;
import java.util.List;
import javafx.application.Application;
import javafx.beans.Observable;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.SelectionMode;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.CheckBoxTableCell;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
import javafx.util.Callback;
public class TableWithCheckbox extends Application {
final TableView<Player> table = new TableView<Player>();
ObservableList<Player> data;
@Override
public void start(Stage primaryStage) {
final BorderPane root = new BorderPane();
table.setItems(createData());
final TableColumn<Player, String> firstNameColumn = new TableColumn<>(
"First Name");
final TableColumn<Player, String> lastNameColumn = new TableColumn<>(
"Last Name");
final TableColumn<Player, Boolean> selectedColumn = new TableColumn<>(
"selected");
firstNameColumn
.setCellValueFactory(new PropertyValueFactory<Player, String>(
"firstName"));
lastNameColumn
.setCellValueFactory(new PropertyValueFactory<Player, String>(
"lastName"));
selectedColumn
.setCellValueFactory(new PropertyValueFactory<Player, Boolean>(
"selected"));
final Callback<TableColumn<Player, Boolean>, TableCell<Player, Boolean>> cellFactory = CheckBoxTableCell
.forTableColumn(selectedColumn);
selectedColumn
.setCellFactory(new Callback<TableColumn<Player, Boolean>, TableCell<Player, Boolean>>() {
@Override
public TableCell<Player, Boolean> call(
TableColumn<Player, Boolean> column) {
TableCell<Player, Boolean> cell = cellFactory
.call(column);
cell.setAlignment(Pos.CENTER);
return cell;
}
});
selectedColumn.setCellFactory(cellFactory);
selectedColumn.setEditable(false);
table.setEditable(true);
table.getColumns().addAll(selectedColumn, firstNameColumn,
lastNameColumn);
table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
root.setCenter(table);
Button button1 = new Button("add");
button1.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
data.add(new Player("hbghj", "hjhbbccc77", false));
}
});
root.setTop(button1);
primaryStage.setScene(new Scene(root, 400, 600));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
private ObservableList<Player> createData() {
List<Player> players = Arrays.asList(
new Player("Hugo", "Lloris", true), new Player("Brad",
"Friedel", false),
new Player("Kyle", "Naughton", false), new Player("Younes",
"Kaboul", false), new Player("Benoit", "Assou-Ekotto",
false), new Player("Jan", "Vertonghen", false),
new Player("Michael", "Dawson", false), new Player("William",
"Gallas", false), new Player("Kyle", "Walker", false),
new Player("Scott", "Parker", false), new Player("Mousa",
"Dembele", false), new Player("Sandro", "Cordeiro",
false), new Player("Tom", "Huddlestone", false),
new Player("Gylfi", "Sigurdsson", false), new Player("Gareth",
"Bale", false), new Player("Aaron", "Lennon", false),
new Player("Jermane", "Defoe", false), new Player("Emmanuel",
"Adebayor", false));
data = FXCollections
.<Player> observableArrayList(new Callback<Player, Observable[]>() {
@Override
public Observable[] call(Player player) {
return new Observable[] { player.selectedProperty() };
}
});
data.addAll(players);
data.addListener(new ListChangeListener<Player>() {
@Override
public void onChanged(
javafx.collections.ListChangeListener.Change<? extends Player> change) {
System.out.println("List changed");
while (change.next()) {
if (change.wasUpdated()) {
System.out.println("What code a do here");
System.out.println();
}
}
}
});
table.getSelectionModel().selectedItemProperty()
.addListener(new ChangeListener<Player>() {
@Override
public void changed(ObservableValue observableValue,
Player oldValue, Player newValue) {
Player currPlayer = table.getSelectionModel()
.getSelectedItem();
System.out.println("after clearSelection");
currPlayer.setSelected(true);
}
});
return data;
}
public static class Player {
private final StringProperty firstName;
private final StringProperty lastName;
private final BooleanProperty selected;
Player(String firstName, String lastName, boolean international) {
this.firstName = new SimpleStringProperty(this, "firstName",
firstName);
this.lastName = new SimpleStringProperty(this, "lastName", lastName);
this.selected = new SimpleBooleanProperty(this, "selected",
international);
}
public String getFirstName() {
return firstName.get();
}
public void setFirstName(String firstName) {
this.firstName.set(firstName);
}
public StringProperty firstNameProperty() {
return firstName;
}
public String getLastName() {
return lastName.get();
}
public void setLastName(String lastName) {
this.lastName.set(lastName);
}
public StringProperty lastNameProperty() {
return lastName;
}
public boolean isSelected() {
return selected.get();
}
public void setSelected(boolean international) {
this.selected.set(international);
}
public BooleanProperty selectedProperty() {
return selected;
}
@Override
public String toString() {
return firstName.get() + " " + lastName.get()
+ (selected.get() ? " (injured)" : "");
}
}
}
在选择任何复选框时,这不会取消选中
其他复选框,因为我认为这不是一个好主意。如果您希望它以这种方式工作,只需将循环添加回来即可。
for (Player pl : players) {
pl.setSelected(false);
}
关于JavaFx8 Tableview 更新 ObservableList,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29386766/
我有一个有趣的问题,我是 JavaFX 的新手,我需要创建一个小众市场 ObservableList执行。 本质上,我需要一个 ObservableList维护另一个 ObservableList 的
如果我有两个单独的 ObservableLists,并且都放在一个单独的 ObservableList 中用于 TableView...有没有办法在这两个 ObservableLists 和聚合的 O
当我尝试将项目设置到 tableView 中时遇到问题,有关我使用 SceneBuilder 的信息。 Main.java: public class Main extends Application
我想知道为什么TableView方法setItems不需要ObservableList作为参数,但是 ObservableList ? 还有什么是最好的转型方式ObservableList至Obser
当我将监听器附加到可观察列表并在该监听器中尝试删除一些元素时,在某些情况下它会通过,而在某些情况下会崩溃。 场景:项目已从列表中删除。它触发监听器,在该监听器中我尝试删除另一个项目。 如果在监听器中我
我在不同的条件下尝试了不同的集合,但我能够收到的所有更改都是排列、添加、删除和替换更改。 更新变化在什么条件下出现?什么基类,什么存储类以及需要什么操作来产生这样的事件? 最佳答案 要生成更新事件,您
This answer为可观察列表提供解决方案,如果列表元素的属性更改,它将发送“列表已更新” 通知>. 在我的例子中,此类可观察列表的元素(元素类)很复杂,我不喜欢为每个成员变量实现属性。因此,我在
这是我的问题:我有一堂 Detenu 课: public class Detenu { private static String n_ecrou; // Unique id p
我正在使用 JavaFX 编写日志读取器应用程序,并且我想根据所选属性实现基于搜索的过滤。 Application screenshot组合框中的值表示填充表的对象字段的名称。现在,我只想显示属性包含
给出以下代码示例: private final ObservableList data = FXCollections.observableArrayList( new Per
我有一个使用 JavaFX 的应用程序。它包含一个ListView(它使用ObservableList)。我使用添加了一个 ChangeListener list.getSelectionModel(
我有一个可观察列表,我尝试通过不同的谓词来过滤它。 我有要进行过滤的嵌套对象。 这是第一个 pojo public Class Transaction { private String na
例如,如果您有一个ArrayList,您可以执行以下操作: ArrayList list = new ArrayList(); ObservableList data = FXCollections.
我不太确定如何表达这个问题,请耐心等待。 我有一个 ObservableList用户定义的对象与几个 getter 方法,例如: public String getName() { return th
编辑 事实证明,当我实际上想要一个深拷贝时,FXCollections.observableArrayList() 正在创建列表的浅拷贝。 this.value 和 value “指向”两个不同的 O
我正在处理一个 javaFx 项目,我们必须在其中使用 ObservableList 添加 Listner。 ObservableList 包含人的模型。但是我想通过序列化将整个 Observable
我有一个自定义对象 FermentableInRecipe,它填充了一个 TableView。为了响应列表中项目的更改以及列表本身,我决定使用提取器。这是我的 ObservableList 的声明和实
我试图理解 ObservableList 和 Realms 的概念。我试图创建一个 ObservableList 的实例,如下所示: public ObservableList createObs
我有一个 Java ObservableList有数千个条目每秒接收数百个更新支持 JavaFX TableView . ObservableList 是 backed by an ArrayList
我有一张 Albums 的表格可由用户过滤和排序。 这是这张 table 的样子。如您所见,列是可排序的,顶部有一个文本框,当前正在过滤其中包含字符串“cu”的专辑: 一切正常专辑列表填充后 . 但是
我是一名优秀的程序员,十分优秀!