We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi,
I want to view table in processing, which has row & colum.
How Can i create visual table in processing ?
Every second i will process some data & data will be update in table in real time.
How can i update data in table in real time ?
Thanks
Answers
http://forum.processing.org/two/discussion/comment/50667/#Comment_50667
Hi,
I would like to refine my question.
I just want to create table, as we see in excel. ( with row & col). You can say spreadsheet.
Where i can add data in fields in real time.
just like data base.
Here i found this link but i am new for java.
don't know how to use it with processing.
http://www.jitendrazaa.com/blog/java/create-excel-file-in-java-using-apache-poi-library/
@roshani=== the link given by Chrisir gives you the answer to your first question (drawing a grid) as for the second one (populating it with data) you can use (from processing) Table() and a lot of methods for getting your values; then you have the choice: or you have some .csv, or you create it on runtime using your data input for creating the Table values. Of course there are a lot of methods & functions in excel that you cannot so easily get working; but i presume that you want only to display your values (strings or int or float...) in the grid.
yes, i want to display only string value in table.
i also read table() command & there is one example.
This example will create csv file with data. It does not show table in processing like this. Here is attached picture.
@roshani:: i don't understand, your picture is too little and what is it??? - How have you get this?? from excel???
--- you make your gui grid, number of cells depending of colomns && rows ---you create your .csv (or you have it && load() --- you add the values to the grid:: txt("", x, y)--- since there are a lot of get methods in Table() -- i have done that and it works without any problem
Dear Akenaton,
I have searched table() function in reference. I also look other function related with table.
But i could not find any function which will create gui grid in processing & then i can update data fields in it.
I also test table() function, they work but they will create excel file in background, excel file does not appear in gui grid format.
Thanks
of course Table() does not create gui grid: you have to draw it by yourself & that is very easy. Then you get the values from your table and display them with text("myvalue", x, y). x & y = x & y coordinates of the cell where you want to display. If you have some array[] with all cells coordinates created when you have firstly made the grid all values can be displayed in order in a for loop.
Dear Akenaton,
there is no option to scroll table, if we want to scroll down table.
Processing is low level
There is no excel ready build in
Your questions are quite vague.
Where do you get the data from? Csv? Hard drive? Format=?
Only int or string as well? How many rows and columns ?
How many chars per cell?
What functions do you need? Copy? Dropdown....?
Do you want to type in stuff with keyboard?
Do you need calculations?
Excel can do all sort of things
Write some code and show it....
Do you know oop / objects/ classes?
Dear Sir,
As you see in my 2nd post, i have provide this link.
http://www.jitendrazaa.com/blog/java/create-excel-file-in-java-using-apache-poi-library/
As you ask for OOP/ Objects/ classes
I know & understand it little bit.
For example controlP5 is basically class, where we can create multiple objects.
Class have its own variable & have function ( may be private or public) etc.
private function can not be called from outside but public functions may be called from outside.
http://www.cs.cf.ac.uk/Dave/HCI/HCI_Handout_CALLER/node167.html
http://java.about.com/od/Creating-Tables/ss/A-Simple-Table-Example-Java-Code-Program.htm
@roshani:: scrolling (with vertical or horizontal bar) is not included in Table() of course; with processing i dont know if there is a library for that (perhaps controlP5???) - I see in reference for processing 3 an example for horizontal bar scrolling:: https://processing.org/examples/scrollbar.html; you can try with that. I never tryed, i cannot tell if it is ok for your problem... Anyway it s easy with java & swing: you create a JFrame instance, and add a vertical (or horizontal) scrollbar (see here :: docs.oracle.com/javase/7/docs/api/javax/swing/JScrollBar.html; basically that is the code which in used by your link (a-Simple_Table...); problem is, in this case, that you have to use java in order to create your grid gui and so on...
Dear Akenaton,
Thanks .
Dear Akenaton,
Here is class for creating gui table with scrollbar.
http://www.java2s.com/Tutorial/Java/0240__Swing/1000__JTable.htm
@roshani::: yes, with Java of course; but you asked for processing and in this case you have to use chrisir code + Table() @&& tableRow() as i told you. As for adding scroll bars (you have also asked for!!!) you can do that with java && the class ScrollBar; as for processing, workaround-solution could be, with eclipse, to create your main class with java (JFrame && JPanel) and to transform your p5 code in another class extending PApplet. After that in the main code (where you create the jFrame && jPanel) you have only to create an instance for your applet class and to add it to the panel:: panel.add(myApplet);
Do you need scrolling vertically or horizontally or both?
With mouse or with keyboard?
@ roshani && @ Chrisir=
let us suppose that you want both (horizontal && vertical) (why not???)
--- as for me (see post ) i have tried with https://processing.org/examples/scrollbar.html for horizontal and seen that it s not so complicated to "translate" it for vertical; yet the result is very ugly and not at all == to java and ui look & feel. That's why i prefer in this case use java.
Using your (chrisir) code for making the gui ( i have only modified some details in order that it could run with Table() && suppressed your color rect (which can be useful if selected... another story!!!!) i have coded some lines with java, which seems to me very less "headache" than the p5 code for some 2 stupids sliders...). You can see & try. What i think is that P5 has to make things java complicated more simple. In this case i dont think!!!! - Tell me...
CODE:
from chrisir (but of course adapted to java use!!! && roshani resquest....though this one is not evident!)
///JAVA:::: (launched from eclipse)
}
small version for processing, not sure whether it's different from yours.
you have to replace the loadString with a table (see above)
Chrisir ;-)