I am working on a project where I need to visualise a sorting algorithm.
I looked around and found Javascript and CSS3 have some good animation functions for blink and swap to visualize this.
But my professor prefers Java so I was wondering if there is a hybrid way of using Java and Javascript where I call these Javascript animation functions inside Java.
I also want a simple way to accomplish the task of animating a sort algorithm as a web application.
This is possible but will probably take a couple of days to implement for a professional software developer.
While you can run JavaScript code in Java, that doesn't give you a full browser (no DOM, no windows, no rendering of CSS and HTML).
So you would need to embed a web browser in Java, first. This is possible but all solutions need JNI or at least hardware specific shared libraries. If you feel up to the task, go for it. I suggest to try SWT. You can find demo code here ; the widget is called Browser
.
If you don't want to spend a month or more on this homework, start with this code .
If you want to know whether you got it right: http://www.sorting-algorithms.com/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.