JAVAFX - Atualizar TableView

1 resposta
javafx
M

"@FXML
public void pesquisarFornecedor(ActionEvent event) throws Throwable {

if (txtPesquisar.getText().equals("")) {
        tabelaFornecedor.setItems(setListaFornecedor());
    } else {
        colId.setCellValueFactory(new PropertyValueFactory("id"));
        colInscricaoEstadual.setCellValueFactory(new PropertyValueFactory("inscricaoEstadual"));
        colNome.setCellValueFactory(new PropertyValueFactory("nomefantasia"));
        colTelefone.setCellValueFactory(new PropertyValueFactory("telefone"));
        tabelaFornecedor.setItems(pesquisar(txtPesquisar.getText()));
    }
}

public ObservableList<Fornecedor> pesquisar(String nome) throws Throwable {
    FornecedorDao dao = new FornecedorDao();
    return FXCollections.observableArrayList(dao.pesquisar(nome));
}"
Erro

"Exception in thread “JavaFX Application Thread” java.lang.RuntimeException: java.lang.reflect.InvocationTargetException

at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1774)

at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1657)

at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)

at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)

at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)

at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)

at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)

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

at javafx.event.Event.fireEvent(Event.java:198)

at javafx.scene.Node.fireEvent(Node.java:8413)

at javafx.scene.control.Button.fire(Button.java:185)

at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)

at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)

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.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)

at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)

at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)

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

at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)

at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)

at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)

at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:394)

at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)"

1 Resposta

M

Ola, o meu problema é que não estou conseguindo atualizar, quando eu faço uma pesquisa não está atualizando a minha tableview com as informações da pesquisa. Obrigado pela ajuda.

Criado 18 de abril de 2018
Ultima resposta 18 de abr. de 2018
Respostas 1
Participantes 1