| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -39,7 +39,7 @@ void setup() { | |||
| 39 | 39 | <description><![CDATA[ | |
| 40 | 40 | <b>Table</b> objects store data with multiple rows and columns, much like in a traditional spreadsheet. Tables can be generated from scratch, dynamically, or using data from an existing file. Tables can also be output and saved to disk, as in the example above.<br /> | |
| 41 | 41 | <br /> | |
| 42 | - Additional <b>Table</b> methods are documented in the <a href="http://processing.github.io/processing-javadocs/core/">Processing Data Javadoc</a>. | ||
| 42 | + Additional <b>Table</b> methods are documented in the <a href="http://processing.github.io/processing-javadocs/core/processing/data/Table.html">Processing Table Javadoc</a>. | ||
| 43 | 43 | ||
| 44 | 44 | ]]></description> | |
| 45 | 45 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,91 @@ | |||
| 1 | + <?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
| 2 | + <root> | ||
| 3 | + | ||
| 4 | + <name>sort()</name> | ||
| 5 | + | ||
| 6 | + <category>Table</category> | ||
| 7 | + | ||
| 8 | + <subcategory>Method</subcategory> | ||
| 9 | + | ||
| 10 | + <type>method</type> | ||
| 11 | + | ||
| 12 | + <example> | ||
| 13 | + <image></image> | ||
| 14 | + <code><![CDATA[ | ||
| 15 | + Table table; | ||
| 16 | + | ||
| 17 | + void setup() { | ||
| 18 | + | ||
| 19 | + table = new Table(); | ||
| 20 | + | ||
| 21 | + table.addColumn("name"); | ||
| 22 | + table.addColumn("type"); | ||
| 23 | + | ||
| 24 | + TableRow newRow = table.addRow(); | ||
| 25 | + newRow.setString("name", "Lion"); | ||
| 26 | + newRow.setString("type", "Mammal"); | ||
| 27 | + | ||
| 28 | + newRow = table.addRow(); | ||
| 29 | + newRow.setString("name", "Snake"); | ||
| 30 | + newRow.setString("type", "Reptile"); | ||
| 31 | + | ||
| 32 | + newRow = table.addRow(); | ||
| 33 | + newRow.setString("name", "Mosquito"); | ||
| 34 | + newRow.setString("type", "Insect"); | ||
| 35 | + | ||
| 36 | + table.sort(0); | ||
| 37 | + | ||
| 38 | + for (TableRow row : table.rows()) { | ||
| 39 | + println(row.getString("name") + ": " + row.getString("type")); | ||
| 40 | + } | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + // Sketch prints: | ||
| 44 | + // Lion: Mammal | ||
| 45 | + // Mosquito: Insect | ||
| 46 | + // Snake: Reptile | ||
| 47 | + ]]></code> | ||
| 48 | + </example> | ||
| 49 | + | ||
| 50 | + <example> | ||
| 51 | + <image></image> | ||
| 52 | + <code><![CDATA[ | ||
| 53 | + Table table; | ||
| 54 | + | ||
| 55 | + void setup() { | ||
| 56 | + | ||
| 57 | + table = new Table(); | ||
| 58 | + | ||
| 59 | + table.addColumn("name"); | ||
| 60 | + | ||
| 61 | + TableRow newRow = table.addRow(); | ||
| 62 | + newRow.setString("name", "Lion"); | ||
| 63 | + newRow.setString("type", "Mammal"); | ||
| 64 | + | ||
| 65 | + newRow = table.addRow(); | ||
| 66 | + newRow.setString("name", "Snake"); | ||
| 67 | + newRow.setString("type", "Reptile"); | ||
| 68 | + | ||
| 69 | + newRow = table.addRow(); | ||
| 70 | + newRow.setString("name", "Mosquito"); | ||
| 71 | + newRow.setString("type", "Insect"); | ||
| 72 | + | ||
| 73 | + table.sort("name"); | ||
| 74 | + | ||
| 75 | + for (TableRow row : table.rows()) { | ||
| 76 | + println(row.getString("name") + ": " + row.getString("type")); | ||
| 77 | + } | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + // Sketch prints: | ||
| 81 | + // Lion: Mammal | ||
| 82 | + // Mosquito: Insect | ||
| 83 | + // Snake: Reptile | ||
| 84 | + ]]></code> | ||
| 85 | + </example> | ||
| 86 | + | ||
| 87 | + <description><![CDATA[ | ||
| 88 | + Sorts (orders) a table based on the values in a column. | ||
| 89 | + ]]></description> | ||
| 90 | + | ||
| 91 | + </root> | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -54,7 +54,7 @@ To stop the code inside of <b>draw()</b> from running continuously, use <b>noLoo | |||
| 54 | 54 | <br /> | |
| 55 | 55 | The number of times <b>draw()</b> executes in each second may be controlled with the <b>frameRate()</b> function.<br /> | |
| 56 | 56 | <br /> | |
| 57 | - It is common to call <b>background()</b> near the beginning of the <b>draw()</b> loop to clear the contents of the window, as shown in the first example above. Since pixels drawn to the window are cumulative, omitting <b>background()</b> may result in unintended results, especially when drawing anti-aliased shapes or text.<br /> | ||
| 57 | + It is common to call <b>background()</b> near the beginning of the <b>draw()</b> loop to clear the contents of the window, as shown in the first example above. Since pixels drawn to the window are cumulative, omitting <b>background()</b> may result in unintended results.<br /> | ||
| 58 | 58 | <br /> | |
| 59 | 59 | There can only be one <b>draw()</b> function for each sketch, and <b>draw()</b> must exist if you want the code to run continuously, or to process events such as <b>mousePressed()</b>. Sometimes, you might have an empty call to <b>draw()</b> in your program, as shown in the second example above. | |
| 60 | 60 | ]]></description> | |
| Back | FazBrowse Home | New Git URL |
0 commit comments