Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Display SPARQL result on Jtable

 
Talya Fernandez
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dears,
I create a SPARQL query and I want to display the result of this query on Jtable.
I do some research and based on previous post concerning this question I create this code, but unfortunately the table does not appear in my  interface. the result appear only in console
I'm sorry if this message seems stupid, but in general I'm beginner with Java and also with SPARQL
Thanks in advance
 
Campbell Ritchie
Marshal
Posts: 52663
121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

You shou‍ld call setVisible after everything else. Whatever is done in line 67 will not be visible.
Why are you using the keyword static so often?
 
Talya Fernandez
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Welcome to the Ranch

You shou‍ld call setVisible after everything else. Whatever is done in line 67 will not be visible.
Why are you using the keyword static so often?


Hello,
I call this method in line 70
this.setVisible(true);
but I think that my error was in while().
but I don't know where is exactly?
Thanks
 
Campbell Ritchie
Marshal
Posts: 52663
121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You shoul‍d run the query in a method of a different class. Don't mix business logic and display in the same class. Run that query and print out all the rows in the ersult set.Once you have got them printing out, you can then add them to a table model object and return that table model object to populate the table with. Are you using a DefaultTableModel? That does not override the toString method, but you should be able to get a Vector from it, and print that. Once you have done that, you should be able to work out whether all your rows are getting into the model or not.
I have forgotten just about everything I ever knew about JTable, so remind yourself about it in the Java™ Tutorials.
 
The knights of nee want a shrubbery. And a tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!