added java2d class
This commit is contained in:
@@ -8,5 +8,6 @@
|
|||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" name="jsoup-1.12.1" level="project" />
|
<orderEntry type="library" name="jsoup-1.12.1" level="project" />
|
||||||
|
<orderEntry type="library" name="fxgraphics2d-1.10" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
@@ -65,7 +65,7 @@ public class CrawlBranch {
|
|||||||
//System.out.println("ERROR -- call crawl before searhing");
|
//System.out.println("ERROR -- call crawl before searhing");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
print(String.format("Searching for %s...\n", word));
|
print(String.format("Searching for %s...", word));
|
||||||
String bodyText = this.htmlDocument.body().text();
|
String bodyText = this.htmlDocument.body().text();
|
||||||
return count(bodyText.toLowerCase(), word.toLowerCase());
|
return count(bodyText.toLowerCase(), word.toLowerCase());
|
||||||
}
|
}
|
||||||
|
|||||||
55
src/main/java/webcrawler/Visualiser.java
Normal file
55
src/main/java/webcrawler/Visualiser.java
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
package main.java.webcrawler;
|
||||||
|
|
||||||
|
import javafx.animation.AnimationTimer;
|
||||||
|
import javafx.application.Application;
|
||||||
|
import javafx.embed.swing.JFXPanel;
|
||||||
|
import javafx.scene.Group;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.canvas.Canvas;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
import org.jfree.fx.FXGraphics2D;
|
||||||
|
|
||||||
|
public class Visualiser extends Application {
|
||||||
|
private Stage stage;
|
||||||
|
private double frameTime = 0;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(Stage primaryStage) throws Exception {
|
||||||
|
this.stage = stage;
|
||||||
|
Canvas canvas = new Canvas(1920, 1080);
|
||||||
|
FXGraphics2D g2d = new FXGraphics2D(canvas.getGraphicsContext2D());
|
||||||
|
draw(g2d);
|
||||||
|
stage.setScene(new Scene(new Group(canvas)));
|
||||||
|
stage.setTitle("Hello Animation");
|
||||||
|
primaryStage.show();
|
||||||
|
|
||||||
|
new AnimationTimer() {
|
||||||
|
long last = -1;
|
||||||
|
@Override
|
||||||
|
public void handle(long now) {
|
||||||
|
if(last == -1)
|
||||||
|
last = now;
|
||||||
|
update((now - last) / 1000000000.0);
|
||||||
|
last = now;
|
||||||
|
draw(g2d);
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw(FXGraphics2D graphics) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(double deltaTime) {
|
||||||
|
this.frameTime += deltaTime;
|
||||||
|
|
||||||
|
if (this.frameTime > 1d / 60d) {
|
||||||
|
updateFrame();
|
||||||
|
this.frameTime = 0d;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateFrame() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user