I will need to do various test runs with the KDTreeTester.java file attached below. It'd be pretty inefficient to change the values (w, h, n, x) every time I finish a run and recompile the file.
That's when I thought it would be pretty handy to just type the values before the main program opens.
import javax.swing.JFrame;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Main program that starts the KDTree visualization
*/
public class KDTreeTester extends JFrame{
int w=400; //width of the window
int h=400; //height of the window
int n=20; //number of points
int x=5; //number of points to be searched (has to be smaller than n)
KDTreeVisualization vis; //the visualization
public KDTreeTester(){
// Initialize the visualization and add it to the main frame.
vis = new KDTreeVisualization(w, h, n);
add(vis);
The code goes on, but I think only that's the relevant part. I need to have a box asking for the four values (width, height, number of points, number of points to be searched). The would have to be parsed from String to int I guess.
What's the best way to implement this?