Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
parkersavani
parkersavani's Profile
2
Posts
0
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
Drawing an empty table
[1 Reply]
28-Aug-2013 07:27 AM
Forum:
Contributed Library Questions
How do I create an empty table like editor using processing. What I want to create is a Table with two columns
If someone enters text in column 1 row 1, a value is displayed in column 2, row 1. See an example below.
Example:
Let's say i want to count number of words in each line in and display the count in the adjacent column. User presses enter and a new row is created
(line) (count)
This is Processing Forum 4
How is everyone 3
User will write something... count gets displayed here..
How do i achieve this?
Any help will be greatly appreciated. I tried to achieve the above using textArea but I couldn't process text line by line.
Below is my code
String text="";
String value="";
public void textarea1_change1(GTextArea source, GEvent event) { //_CODE_:textarea1:331610:
String textAreaText= source.getText();
String[] lines=textAreaText.split("\n");
process(lines[lines.length-1]);
}
public void textarea2_change1(GTextArea source, GEvent event) {
}
synchronized public void win_draw1(GWinApplet appc, GWinData data) {
appc.background(230);
}
public void process(String text){
String[] words=text.split(" ");
if(words!=null){
textarea2.setText(words.length()); // if I use setText the previous value will be erased.
}
}
public void createGUI(){
G4P.messagesEnabled(false);
G4P.setGlobalColorScheme(GCScheme.BLUE_SCHEME);
G4P.setCursor(ARROW);
if(frame != null)
frame.setTitle("Sketch Window");
textarea1 = new GTextArea(this, 2, 3, 528, 595, G4P.SCROLLBARS_NONE);
textarea1.setOpaque(true);
textarea1.addEventHandler(this, "textarea1_change1");
textarea2 = new GTextArea(this, 533, 4, 267, 596, G4P.SCROLLBARS_NONE);
textarea2.setLocalColorScheme(GCScheme.CYAN_SCHEME);
textarea2.setOpaque(true);
textarea2.addEventHandler(this, "textarea2_change1");
}
LineListener for TextArea?
[1 Reply]
26-Aug-2013 06:21 PM
Forum:
General Discussion
I am new to processing and I was wondering if there's something called linelistener or something.
I have two textboxes in a window and what i want to do is process text line by line
Example:
Let's say i want to count number of words in each line in textarea1 and display the count in textarea2
textarea1 (line) textarea2 (count)
This is Processing Forum 4
How is everyone 3
How do i achieve this?
«Prev
Next »
Moderate user : parkersavani
Forum