go through vida examples to make sure everything still runs

This commit is contained in:
benfry
2012-12-17 01:51:06 +00:00
parent ffe9480796
commit dd8b7ae2c0
7 changed files with 37 additions and 47 deletions
@@ -16,7 +16,9 @@ Edition by Ben Fry. Copyright 2008 Ben Fry, 9780596514556.”
If you feel your use of code examples falls outside fair use or the permission
given above, feel free to contact us at permissions@oreilly.com.
*/
import java.util.Date;
import java.util.regex.*;
import java.text.*;
int teamCount = 30;
String[] teamNames;
@@ -79,7 +79,7 @@ float boundsX2, boundsY2;
public void setup() {
size(720, 453, P3D);
size(720, 453);
mapX1 = 30;
mapX2 = width - mapX1;
@@ -88,7 +88,6 @@ public void setup() {
font = loadFont("ScalaSans-Regular-14.vlw");
textFont(font);
textMode(SCREEN);
messageX = 40;
messageY = height - 40;
@@ -129,7 +128,6 @@ public void setup() {
void readData() {
new Slurper();
noLoop(); // done loading, can stop updating
}
@@ -11,7 +11,9 @@ Node rootNode;
void setup() {
size(400, 130);
// Replace this location with a folder on your machine
File rootFile = new File("/Applications/Processing 0135");
//File rootFile = new File("/Applications/Processing.app");
//File rootFile = new File("c:\\processing-2.0");
File rootFile = new File(System.getProperty("user.home"));
rootNode = new Node(rootFile);
PFont font = createFont("SansSerif", 11);
textFont(font);
@@ -1,5 +1,7 @@
// Code from Visualizing Data, First Edition, Copyright 2008 Ben Fry.
import java.util.Arrays;
class RankedLongArray {
long[] values = new long[100];
@@ -16,7 +16,7 @@ Edition by Ben Fry. Copyright 2008 Ben Fry, 9780596514556.”
If you feel your use of code examples falls outside fair use or the permission
given above, feel free to contact us at permissions@oreilly.com.
*/
import treemap.*;
//import treemap.*;
import javax.swing.*;
@@ -43,35 +43,23 @@ void setup() {
font = createFont("SansSerif", 13);
selectRoot();
selectFolder("Choose a folder to browse...", "setRoot");
}
void selectRoot() {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JFileChooser fc = new JFileChooser();
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
fc.setDialogTitle("Choose a folder to browse...");
int returned = fc.showOpenDialog(frame);
if (returned == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
setRoot(file);
}
}
});
}
void setRoot(File folder) {
FolderItem tm = new FolderItem(null, folder, 0, 0);
tm.setBounds(0, 0, width, height);
tm.contentsVisible = true;
if (folder == null) {
println("No folder selected.");
rootItem = tm;
rootItem.zoomIn();
rootItem.updateColors();
} else {
FolderItem tm = new FolderItem(null, folder, 0, 0);
tm.setBounds(0, 0, width, height);
tm.contentsVisible = true;
rootItem = tm;
rootItem.zoomIn();
rootItem.updateColors();
}
}